[Test Improver] test: add unit tests for deps/_utils.py utility functions#672
Draft
danielmeppiel wants to merge 1 commit intomainfrom
Draft
[Test Improver] test: add unit tests for deps/_utils.py utility functions#672danielmeppiel wants to merge 1 commit intomainfrom
danielmeppiel wants to merge 1 commit intomainfrom
Conversation
Add 43 unit tests covering all functions in apm_cli/commands/deps/_utils.py: - _scan_installed_packages: empty dir, nonexistent, GitHub/ADO style, hidden package dirs, multiple packages - _is_nested_under_package: top-level, nested inside parent package - _count_primitives: prompts, instructions, agents, skills, hooks, root-level files, mixed primitives - _count_package_files / _count_workflows: context dirs, workflow files, root-level prompts, combined - _get_detailed_context_counts: instructions, chatmodes, context (singular dir -> 'contexts' key) - _get_package_display_info: valid apm.yml, missing apm.yml, display_name format, corrupt yaml fallback - _get_detailed_package_info: full info, no apm.yml defaults, hooks count, absolute install_path, 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 here - I'm an automated AI assistant focused on improving test coverage for this repository.
Goal
apm_cli/commands/deps/_utils.pycontained utility functions with minimal test coverage (~50%). These pure filesystem helpers are used by thedeps list,deps tree,deps info, andviewcommands, making them important to validate independently.Approach
Added 43 unit tests in
tests/unit/test_deps_utils.pycovering all 8 utility functions:_scan_installed_packages_is_nested_under_package_count_primitives_count_package_files/_count_workflows_get_detailed_context_countscontext/dir ->contextskey_get_package_display_info_get_detailed_package_infoOne insight from writing the tests:
_scan_installed_packagesonly skips candidate directories whose own name starts with.— it still traverses into hidden parent directories. Tests document this actual behavior.Coverage Impact
deps/_utils.pycovered indirectly viatest_deps_list_tree_info.py(partial, ~50% estimated)Test Status
All 3866 tests pass (3823 baseline + 43 new):
Reproducibility