Skip to content

[Test Improver] test: add unit tests for BaseIntegrator shared infrastructure#599

Draft
danielmeppiel wants to merge 1 commit intomainfrom
test-assist/base-integrator-coverage-24059106873-43f27e325d3fe3cd
Draft

[Test Improver] test: add unit tests for BaseIntegrator shared infrastructure#599
danielmeppiel wants to merge 1 commit intomainfrom
test-assist/base-integrator-coverage-24059106873-43f27e325d3fe3cd

Conversation

@danielmeppiel
Copy link
Copy Markdown
Collaborator

🤖 Test Improver — automated AI assistant

Goal and Rationale

BaseIntegrator is the shared infrastructure layer that every file-level integrator inherits from. Several of its methods had no direct unit tests, relying only on indirect coverage from higher-level integrator tests:

  • normalize_managed_files() — path-separator normalisation (backslash → forward slash)
  • cleanup_empty_parents() — bottom-up empty-directory removal after uninstall
  • sync_remove_files() — manifest-based file removal with legacy glob fallback
  • find_files_by_glob() — file discovery with subdir support and deduplication
  • IntegrationResult — dataclass defaults and optional fields
  • should_integrate() — base guard

These are security- and correctness-critical paths. sync_remove_files validates deploy paths before removing files; cleanup_empty_parents must not over-delete; find_files_by_glob must reject symlinks pointing outside the package.

Approach

Added tests/unit/integration/test_base_integrator.py with 30 focused tests:

Class Methods Covered Tests
TestIntegrationResult dataclass defaults, optional fields 3
TestShouldIntegrate always returns True 2
TestNormalizeManagedFiles None passthrough, backslash norm, empty set 5
TestCleanupEmptyParents removes empties, skips stop_at, skips non-empty, empty input, multi-file, ghost paths 6
TestSyncRemoveFiles prefix filter, skip non-match, nonexistent, legacy glob, missing dir, empty set vs None, traversal rejection 7
TestFindFilesByGlob root, subdirs, dedup, missing subdirs, no matches, symlink rejection, no-subdirs arg 7

Test Status

All 30 new tests pass. Full unit suite: 3704 passed (no regressions).

python3 -m uv run pytest tests/unit/integration/test_base_integrator.py -x -q
# 30 passed in 0.77s

python3 -m uv run pytest tests/unit tests/test_console.py -x -q
# 3704 passed in 17.74s

Reproducibility

uv run pytest tests/unit/integration/test_base_integrator.py -x -q

Generated by Daily Test Improver ·

To install this agentic workflow, run

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

Cover previously-untested methods in BaseIntegrator:
- IntegrationResult dataclass (defaults and optional fields)
- should_integrate() always-True guard
- normalize_managed_files() backslash normalisation
- cleanup_empty_parents() bottom-up empty-dir removal
- sync_remove_files() manifest mode + legacy glob fallback
- find_files_by_glob() discovery, deduplication, subdir support

30 new tests, all passing alongside existing suite (3704 total).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant