[Test Improver] test: expand view command coverage (66% -> 95%)#713
Draft
danielmeppiel wants to merge 1 commit intomainfrom
Draft
[Test Improver] test: expand view command coverage (66% -> 95%)#713danielmeppiel wants to merge 1 commit intomainfrom
danielmeppiel wants to merge 1 commit intomainfrom
Conversation
Add 14 new tests covering: - Rich panel rendering paths (display_package_info, display_versions) - Lockfile ref/commit display (_lookup_lockfile_ref, lines 107-118) - Context file and workflow counts in both Rich and plain-text paths - Hook file display in both Rich and plain-text paths - --global flag scope resolution (lines 354-356) - Global scope missing apm_modules/ error handling Coverage: 66% -> 95% (195 stmts, 9 remaining in exception guards) Tests: 19 -> 33 (+14) 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
src/apm_cli/commands/view.pywas at 66% coverage (67 missing statements). Key untested paths included the Rich rendering codepaths, lockfile ref/commit display, context file and workflow counts, hook display, and the--globalscope flag.What was tested
14 new tests across 4 new test classes added to
tests/unit/test_view_command.py:TestViewCommandRichDisplayTestViewLockfileRef_lookup_lockfile_ref+ ref/commit in outputTestViewHooksTestViewGlobalScope--globalflag and user-scope resolutionCoverage
commands/view.pyRemaining 9 uncovered lines are defensive exception handlers (
PathTraversalErrorfromensure_path_within,except Exceptionin lockfile lookup, and the outerexcept Exceptionindisplay_package_info) — not practical to trigger in unit tests.Approach
_force_rich_fallback()so the RichPanel/Tablepaths executeapm.lock.yamlusingyaml.safe_dumpto exercise_lookup_lockfile_ref(lines 107–118).apm/instructions/and.apm/prompts/dirs to hit count > 0 branchesapm_cli.core.scope.get_apm_dirdirectlyTest status
All 3841 unit tests pass (up from 3827 on main, +14 new tests).
Commands to reproduce