Refactor agent CLI tests to eliminate real subprocess calls#328
Merged
Conversation
Introduces CommandExecutor interface to abstract exec.CommandContext, allowing tests to inject a mock instead of spawning echo/cat/sh. All 7 affected tests now verify behavior via mock fields with zero subprocess calls. Closes #318 💘 Generated with Crush Assisted-by: Crush:claude-opus-4-6
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (35.71%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #328 +/- ##
==========================================
- Coverage 67.60% 67.50% -0.10%
==========================================
Files 49 49
Lines 7568 7573 +5
==========================================
- Hits 5116 5112 -4
- Misses 2110 2119 +9
Partials 342 342 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CommandExecutorinterface to abstractexec.CommandContextinagentQuery, enabling dependency injection for testsCommandParsing,MultiWordCommand,CommandNotFound,StderrCaptured,PassesEnvVars,PipesStdin,EmptyCommand) to use amockCommandExecutor— zero subprocess calls, fully self-containedTest plan
make test-allpasses locally (fmt-check, vet, lint, test, test-race, test-fixtures)make plan-checkpassesmake readme-checkpassesCloses #318
💘 Generated with Crush