[Test Improver] test: add unit tests for output module (models, formatters, script_formatters)#498
Draft
danielmeppiel wants to merge 1 commit intomainfrom
Conversation
…rmatters) Cover apm_cli/output/*.py which had zero dedicated tests: - output/models.py: ProjectAnalysis, OptimizationDecision, PlacementSummary, OptimizationStats, CompilationResults (properties and edge cases) - output/formatters.py: CompilationFormatter default/verbose/dry-run paths, _format_issues, _get_placement_description, _format_coverage_explanation, strategy helpers, all tested with use_color=False for determinism - output/script_formatters.py: ScriptExecutionFormatter -- header, compilation progress, runtime execution, content preview, env setup, success/error, subprocess details, auto-discovery message 72 new tests, 3235 total passing. 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.
🤖 This is an automated PR from Test Improver, an AI assistant that systematically improves test coverage for this repository.
Goal and Rationale
apm_cli/output/had zero dedicated tests despite containing 1,384 lines of formatting logic used in compilation output. This PR adds 72 tests covering all three output module files:output/models.py(122 lines) — data models for compilation resultsoutput/formatters.py(916 lines) — professional CLI formatter for compilationoutput/script_formatters.py(346 lines) — formatter for script execution outputThese formatters are called during every
apm compileandapm runexecution, making them high-value test targets for catching regressions in user-visible output.Approach
output/models.py): Tests for all properties, edge cases (zero total_dirs, empty sets, negative efficiency improvement), and boundary values.output/formatters.py): Tests usinguse_color=Falsefor deterministic string output. Coversformat_default,format_verbose,format_dry_run, and all private formatting helpers (_format_issues,_get_placement_description,_format_coverage_explanation, strategy helpers).output/script_formatters.py): Tests usinguse_color=False. Covers all public methods includingformat_compilation_progress(empty/single/multiple),format_execution_success/error,format_subprocess_details,format_auto_discovery_message.Coverage Impact
output/models.pyoutput/formatters.pyoutput/script_formatters.pyTest Status
All tests pass. No pre-existing failures.
Reproducibility