Skip to content

[Test Improver] test: add unit tests for uninstall engine helpers#1059

Closed
danielmeppiel wants to merge 1 commit intomainfrom
test-assist/uninstall-engine-helpers-0a97b7daed41456f
Closed

[Test Improver] test: add unit tests for uninstall engine helpers#1059
danielmeppiel wants to merge 1 commit intomainfrom
test-assist/uninstall-engine-helpers-0a97b7daed41456f

Conversation

@danielmeppiel
Copy link
Copy Markdown
Collaborator

🤖 Test Improver — automated AI assistant

Goal

src/apm_cli/commands/uninstall/engine.py had no dedicated unit tests. This PR adds 21 tests for four focused helper functions that implement the core uninstall logic.

What is tested

Helper Tests Why it matters
_build_children_index 5 Orphan-detection depends on correct parent→children mapping
_parse_dependency_entry 5 Entry point for all dep parsing; wrong dispatch causes silent skips
_validate_uninstall_packages 7 Determines which packages are removed — false negatives are user-visible bugs
_remove_packages_from_disk 4 Filesystem writes; missing path and no-module-dir edge cases

Coverage impact

Metric Before After
Tests passing 6708 6729
New tests +21

(Pre-existing failures in test_audit_report.py and test_deps_update_command.py are unrelated and unchanged.)

How to test

uv run pytest tests/unit/commands/test_uninstall_engine.py -v
# 21 passed

Test status

All 21 new tests pass. Full suite: 6708 passed + 21 new = 6729 passed.

Generated by Daily Test Improver

Generated by Daily Test Improver · ● 2.6M ·

To install this agentic workflow, run

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

Add 21 tests covering four untested helpers in
src/apm_cli/commands/uninstall/engine.py:

- _build_children_index: parent/child traversal logic
- _parse_dependency_entry: string, dict, passthrough, and error cases
- _validate_uninstall_packages: match/no-match/invalid-format paths
- _remove_packages_from_disk: disk removal and missing-path behaviour

All 21 tests pass. Pre-existing failures (test_audit_report.py syntax
error, test_deps_update_command.py Group.cli) are unrelated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@danielmeppiel danielmeppiel added automation Deprecated: use type/automation. Kept for issue history; will be removed in milestone 0.10.0. testing Deprecated: use area/testing. Kept for issue history; will be removed in milestone 0.10.0. labels Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation Deprecated: use type/automation. Kept for issue history; will be removed in milestone 0.10.0. testing Deprecated: use area/testing. Kept for issue history; will be removed in milestone 0.10.0.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant