Testing
Testing Path Header Scanner
Validate one scanning contract first, then the complete language-aware suite.
python -m pytestCategory
Quick Command
python -m pytest [PATH] [OPTIONS]Overviewโ
Use temporary source trees for scanner tests. Preview must remain read-only,
--apply may update only selected supported files, and --dry-run must override
both explicit and configured apply behavior.
Test Layers
Where Scanner Behavior Is Exercised
CLI
Scan Core
Languages
Integration and Safety
Focused Validation
# Scanner processing and updates
python -m pytest tests/core/scan
# One language strategy
python -m pytest tests/languages/test_python_strategy.py
# Full scan integration
python -m pytest tests/integration/test_full_scan.py
# Dry-run regression boundaries
python -m pytest tests/test_dry_run.pyOn Windows, pass a repository-local --basetemp when the system temporary
directory cannot be accessed.
What to Test
Before You Begin
- PreviewRequired
Assert discovery and planned changes without target-file writes.
- ApplyRequired
Assert only selected supported files receive the expected header insertion or update.
- Dry-run overrideRequired
Prove --dry-run overrides --apply and configured apply=true.
- Language strategyRequired
Cover syntax, existing valid headers, stale headers, unsupported content, and path rendering.
- Exclusions and pathsRequired
Cover workdir, relative targets, ignored directories, virtual environments, caches, and build output.
Pre-Commit Quality Gates
The hook runs Ruff lint fixes, Ruff formatting, Black, trailing-whitespace
cleanup, and final-newline correction.make pre-commit-validate
make pre-commit-run-staged
make pre-commit-run
Protected reference-file exclusions apply even when a hook or editor supplies a matching path explicitly.
Complete Validation
python -m pytest
make checkFor developer-workflow changes, also validate make help, representative Make
dry-runs, Docker and Compose configuration, and development and production CLI
--help startup. Do not publish packages or images during routine validation.