[Test Improver] tests(install): add unit tests for integration template module#1287
Draft
danielmeppiel wants to merge 1 commit into
Draft
[Test Improver] tests(install): add unit tests for integration template module#1287danielmeppiel wants to merge 1 commit into
danielmeppiel wants to merge 1 commit into
Conversation
Cover run_integration_template and _integrate_materialization: - acquire() returning None (no-op) - package_info=None / empty targets (no-op integration) - security scan rejecting a package - successful integration flow with delta accumulation - skill_subset routing (from CLI vs from dep_ref) - exception handling: error recorded in diagnostics - local dep path used as diagnostic key for is_local deps - verbose diagnostics: skip/error count singular and plural forms All 13 tests pass; lint clean. 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 test improvements.
Goal and Rationale
src/apm_cli/install/template.pyis a central integration hub - every dependency source (local, cached, fresh download) funnels throughrun_integration_templateafter acquisition. Despite being a critical path, it had no dedicated unit tests.The module orchestrates three key gates:
integrate_package_primitives)Regressions in this flow (wrong skip conditions, silent exception swallowing, wrong diagnostic keys) could cause installs to silently skip primitives or mis-report errors.
Approach
New file
tests/unit/install/test_integration_template.pywith 13 unit tests across 6 test classes. Usesunittest.mock.patchandMagicMockto isolate each branch cleanly.Key branches covered:
acquire()returningNone->run_integration_templatereturnsNoneand never calls integrationpackage_info=Noneor emptytargets-> no-op: empty deployed list recorded, deltas returned unchangedFalse-> integration skippedintegrate_package_primitivesresult; deployed files recordedskill_subsetrouting:ctx.skill_subsetwhenskill_subset_from_cli=True, elsedep_ref.skill_subsetintegrate_package_primitives-> error recorded in diagnostics; deltas still returneddep_ref.local_pathused instead ofdep_keywhenis_local=TrueCoverage Impact
install/template.py: 0 dedicated testsTrade-offs
integrate_package_primitivesinternals (already covered elsewhere)Reproducibility
Test Status
ruff check+ruff format --checkboth silent)test_policy_status.pyANSI tests (unrelated, unchanged)Note
🔒 Integrity filter blocked 19 items
The following items were blocked because they don't meet the GitHub integrity level.
list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: