Skip to content

[Test Improver] test: add unit tests for output module (models, formatters, script_formatters)#498

Draft
danielmeppiel wants to merge 1 commit intomainfrom
test-assist/output-module-coverage-23775479086-12a8daa719190b48
Draft

[Test Improver] test: add unit tests for output module (models, formatters, script_formatters)#498
danielmeppiel wants to merge 1 commit intomainfrom
test-assist/output-module-coverage-23775479086-12a8daa719190b48

Conversation

@danielmeppiel
Copy link
Copy Markdown
Collaborator

🤖 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 results
  • output/formatters.py (916 lines) — professional CLI formatter for compilation
  • output/script_formatters.py (346 lines) — formatter for script execution output

These formatters are called during every apm compile and apm run execution, making them high-value test targets for catching regressions in user-visible output.

Approach

  • Data models (output/models.py): Tests for all properties, edge cases (zero total_dirs, empty sets, negative efficiency improvement), and boundary values.
  • CompilationFormatter (output/formatters.py): Tests using use_color=False for deterministic string output. Covers format_default, format_verbose, format_dry_run, and all private formatting helpers (_format_issues, _get_placement_description, _format_coverage_explanation, strategy helpers).
  • ScriptExecutionFormatter (output/script_formatters.py): Tests using use_color=False. Covers all public methods including format_compilation_progress (empty/single/multiple), format_execution_success/error, format_subprocess_details, format_auto_discovery_message.

Coverage Impact

Module Before After
output/models.py 0% ~95%
output/formatters.py 0% ~60%+
output/script_formatters.py 0% ~80%+

Test Status

72 passed in 0.31s
3235 passed in 12.61s  (full unit suite)

All tests pass. No pre-existing failures.

Reproducibility

uv run pytest tests/unit/test_output_module.py -v
uv run pytest tests/unit tests/test_console.py -x -q

Generated by Daily Test Improver ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/daily-test-improver.md@b87234850bf9664d198f28a02df0f937d0447295

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant