Test Coverage¶
Coverage Report¶
The markdown coverage report includes:
- Coverage percentages by module
- Line counts (statements, missing, excluded)
- Per-file breakdown
- Overall totals
Auto-generated Report
The coverage_report.md file is automatically generated by the CI/CD pipeline on every commit to the main branch. It
shows the latest test coverage metrics in a clean markdown table format.
Target Coverage¶
- Critical modules (enriched layer, data pipelines): > 80%
- Utility functions: > 70%
- Overall project: > 60%
Improving Coverage¶
Running Coverage Locally¶
# Run tests with coverage
uv run pytest --cov=biocloudcore --cov-report=term-missing
# Generate markdown report
uv run coverage report --format=markdown
Finding Untested Code¶
The --cov-report=term-missing flag shows which lines aren't covered:
This tells you:
- File has 85% coverage
- Lines 12-15 and 42 are not tested
Quick Wins¶
- Test edge cases - Empty inputs, null values, missing lookups
- Test error paths - What happens when things go wrong?
- Test parameter variations - Use
@pytest.mark.parametrize
Coverage in CI/CD¶
Every commit to main triggers:
- Test execution with coverage tracking
- Markdown coverage report generation via
coverage.py - Badge update on README
- Report deployment to docs site
The pipeline ensures coverage never silently degrades.