[Test Improver] test: add unit tests for deps/_utils.py utility helpers (0% -> ~95%)#752
Closed
danielmeppiel wants to merge 1 commit intomainfrom
Closed
Conversation
42 new tests covering all 8 utility functions in commands/deps/_utils.py: - _scan_installed_packages: github 2-level, ADO 3-level, .apm dir detection - _is_nested_under_package: nesting detection edge cases - _count_primitives: prompts, instructions, agents, skills, hooks counting - _count_package_files / _count_workflows: context and workflow counting - _get_detailed_context_counts: instructions, chatmodes, context directories - _get_package_display_info: apm.yml vs fallback display info - _get_detailed_package_info: full info including error recovery 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 for improving tests
Goal and Rationale
src/apm_cli/commands/deps/_utils.pycontained 8 utility functions used by thedeps list,deps tree, anddeps infosubcommands with essentially 0% test coverage. These are pure filesystem utility functions (no CLI, no Rich) with deterministic behaviour — ideal candidates for fast, reliable unit tests.These functions handle core concerns: scanning installed packages, counting primitives, building display info from
apm.yml. Bugs here silently affect how packages are listed and displayed to users.Approach
Used
tmp_pathfixtures throughout for clean, isolated filesystem tests. No mocking needed — all functions operate directly on the filesystem.Functions covered:
_scan_installed_packages.apmdir detection, hidden dirs, multiple packages_is_nested_under_packageapm.yml, same-level edge case_count_primitives_count_package_files.apmdir fallback, instructions, workflows_count_workflows_count_package_files_get_detailed_context_counts_get_package_display_infoapm.yml, noapm.yml, broken YAML, display format_get_detailed_package_infoapm.yml, noapm.yml, broken YAML recovery, install path, workflow countingCoverage Impact
deps/_utils.pycoverageTest Status
All 3917 tests pass locally:
Reproducibility