Skip to content

[Test Improver] test: extend list command and compile display helper coverage (+33 tests)#486

Draft
danielmeppiel wants to merge 1 commit intomainfrom
test-assist/compile-display-helpers-23723572616-e9930a5aa910dcbd
Draft

[Test Improver] test: extend list command and compile display helper coverage (+33 tests)#486
danielmeppiel wants to merge 1 commit intomainfrom
test-assist/compile-display-helpers-23723572616-e9930a5aa910dcbd

Conversation

@danielmeppiel
Copy link
Copy Markdown
Collaborator

🤖 Test Improver here - automated AI assistant focused on improving tests for this repository.

Goal and Rationale

Two command modules had very thin test coverage:

Module Before After
commands/list_cmd.py (101 lines) 1 test 14 tests
commands/compile/cli.py display helpers (165 lines) 0 tests 20 tests

The list command has multiple branches (empty scripts, scripts with/without start, Rich path, Rich exception fallback, error path) that were unexercised. The compile display helpers (_display_single_file_summary, _display_next_steps, _display_validation_errors, _get_validation_suggestion) are user-facing output functions with both Rich and plain-text paths — neither had any tests.

Approach

test_list_command_extended.py (13 tests)

  • NoScripts: empty dict → warning shown, fallback example rendered
  • WithScripts: start key → default label appears; without start → no label; all script names/commands rendered
  • RichPath: mocked console → console.print called; Rich exception → plain-text fallback
  • ErrorHandling: exception in _list_available_scripts → exit code 1 + error message

test_compile_display_helpers.py (20 tests)

  • _get_validation_suggestion: all four branches (missing description, applyTo, empty content, fallback)
  • _display_validation_errors: empty list, single error with/without : separator, Rich path, fallback path
  • _display_next_steps: filename included in output, install step shown, Rich path
  • _display_single_file_summary: primitives count, constitution hash, None hash → dash, dry-run, empty stats dict

Coverage Impact

File Tests Before Tests After Delta
commands/list_cmd.py 1 14 +13
commands/compile/cli.py helpers 0 20 +20
Total suite 3108 3141 +33

Test Status

All 3141 tests pass:

uv run pytest tests/unit tests/test_console.py -x -q
3141 passed in 12.21s

Reproducibility

uv run pytest tests/unit/test_list_command_extended.py tests/unit/test_compile_display_helpers.py -v
# All 33 tests pass

uv run pytest tests/unit tests/test_console.py -x -q
# 3141 passed

Trade-offs

  • Tests mock _get_console and _list_available_scripts to isolate display logic — straightforward and low-maintenance
  • No new dependencies

Generated by Daily Test Improver ·

To install this agentic workflow, run

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

…tests)

- Add 13 tests for apm list command covering all branches:
  empty scripts, scripts with/without start key, Rich path,
  Rich exception fallback, and error handling
- Add 20 tests for compile CLI display helpers:
  _get_validation_suggestion, _display_validation_errors,
  _display_next_steps, and _display_single_file_summary
  (both Rich and fallback paths)

Total: +33 tests, 3108->3141 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