[Test Improver] test: add unit tests for compile CLI display helpers#522
Draft
danielmeppiel wants to merge 1 commit intomainfrom
Draft
[Test Improver] test: add unit tests for compile CLI display helpers#522danielmeppiel wants to merge 1 commit intomainfrom
danielmeppiel wants to merge 1 commit intomainfrom
Conversation
Add 23 unit tests covering the four pure/display-layer helpers in apm_cli.commands.compile.cli: * _get_validation_suggestion -- all 4 branches (description, applyTo, empty content, generic fallback) plus type safety * _display_validation_errors -- rich table path, fallback when no console, ImportError fallback, colon-split error parsing, empty list * _display_next_steps -- rich panel path, fallback when no console, ImportError fallback, custom output filename * _display_single_file_summary -- rich table path, no-console fallback, dry-run mode, real file size computation, missing stats defaults, None hash handling, exception fallback All 23 tests pass against the 3422-test suite (0 regressions). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
🤖 Test Improver — automated AI assistant
Goal and Rationale
The
apm compilecommand has 578 lines of CLI logic, but only a single subprocess-level integration test (test_compile_rich_output.py, 19 lines). The four display helper functions —_get_validation_suggestion,_display_validation_errors,_display_next_steps, and_display_single_file_summary— had zero unit tests. These helpers are called on every successful or failed compilation and handle user-facing feedback including validation errors.Approach
Unit tests for the four pure/display-layer helpers in
apm_cli.commands.compile.cli:_get_validation_suggestion_display_validation_errorsImportErrorfallback, colon-split error parsing, empty error list, multi-error table_display_next_stepsImportErrorfallback, custom output filename in output_display_single_file_summary.get()defaults,Nonehash renders as-, exception fallbackMocks patch
apm_cli.commands.compile.cli._get_console(the resolved import name) so tests work without a live terminal.Coverage Impact
commands/compile/cli.py(helpers only)Trade-offs
compile()Click command orchestration is out of scope (requires project fixture setup and is covered by the subprocess integration test).Reproducibility