Testing¶
Astro uses pytest with pytest-cov. Coverage must remain at or above 80%.
Test-first workflow¶
Read the relevant section of
SPEC.mdAdd or update a failing test in
tests/Run
pytest path/to/test.pyand confirm it fails for the expected reasonImplement the minimal change in
src/astro/Run
make checkand confirm all gates pass
Do not implement features without a failing test first. Do not skip tests because a command is a stub.
Test layout¶
Directory |
Purpose |
|---|---|
|
Typer CLI tests using |
|
Discovery and |
|
Ingest service and materialization |
|
Run service, parallel execution, quarantine |
|
Filter executor and store |
|
Quarantine store |
|
Large-file streaming |
|
|
|
Canonical ID resolver |
|
Statistics recorder |
|
Run manager, manifest, and cleanup |
|
Package smoke tests |
Running tests¶
make test # full suite with coverage
make cov # include large-file integration tests
pytest tests/cli/ -q # single directory
pytest -k "test_ingest" -q # by name pattern
make cov-html # HTML coverage report
Markers¶
Mark slow or fixture-heavy tests:
@pytest.mark.integration
def test_full_pipeline_run():
...
Large-file integration tests use @pytest.mark.large and are excluded from the default make check run.
Coverage¶
Configuration in pyproject.toml:
Minimum coverage: 80%
Branch coverage enabled
Source:
src/astro