Skip to content

test: add unit tests for drift_checker.py#3574

Merged
mrveiss merged 1 commit intoDev_new_guifrom
issue-3428
Apr 6, 2026
Merged

test: add unit tests for drift_checker.py#3574
mrveiss merged 1 commit intoDev_new_guifrom
issue-3428

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Apr 6, 2026

Closes #3428

Changes

New file: autobot-slm-backend/services/drift_checker_test.py — 38 tests across 7 test classes:

Class Tests Covers
TestFileChecksum 4 SHA-256 computation, empty files, large files, uniqueness
TestCollectChecksums 7 Extension filtering, excluded dirs, relative paths, unreadable files
TestComputeDrift 13 Modified/added/removed files, missing dirs, nested paths, edge cases
TestBuildDriftReport 6 Schema keys, drift flags, timestamps, path fields
TestGetDefaultDeployedDir 3 Root path, env override, component suffix
TestGetDefaultSourceDir 3 Exists/missing dir, env var
TestAllowedComponents 2 Allowlist contents, frozenset type, path traversal absent

All tests are fully offline — no filesystem reads outside tmp_path, no Redis, no network. services.git_tracker is patched at import time via stub injection.

pytest.ini: Added --import-mode=importlib to addopts so co-located tests inside packages with heavy __init__.py (like services/) collect without triggering package __init__ before conftest stubs are in place. Verified no regression on the existing 55 SLM tests (same 22 pre-existing failures, same 33 passing before and after).

🤖 Generated with Claude Code

@mrveiss
Copy link
Copy Markdown
Owner Author

mrveiss commented Apr 6, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@mrveiss mrveiss merged commit bc2675b into Dev_new_gui Apr 6, 2026
1 of 4 checks passed
@mrveiss mrveiss deleted the issue-3428 branch April 6, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant