Skip to content

Test Coverage

coverage report

Coverage Report

View Detailed 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:

biocloudcore/enriched/dna/amplicon.py    85%   12-15, 42

This tells you:

  • File has 85% coverage
  • Lines 12-15 and 42 are not tested

Quick Wins

  1. Test edge cases - Empty inputs, null values, missing lookups
  2. Test error paths - What happens when things go wrong?
  3. Test parameter variations - Use @pytest.mark.parametrize

Coverage in CI/CD

Every commit to main triggers:

  1. Test execution with coverage tracking
  2. Markdown coverage report generation via coverage.py
  3. Badge update on README
  4. Report deployment to docs site

The pipeline ensures coverage never silently degrades.