Coverage
Install pytest-cov to measure which lines are executed by your tests.
Install pytest-cov to measure which lines are executed by your tests.
# Install
pip install pytest-cov
# Run with coverage
pytest --cov=myapp --cov-report=html
# Enforce minimum coverage
pytest --cov=myapp --cov-fail-under=80
# .coveragerc
[run]
omit = */migrations/*, */tests/*, manage.py
[report]
show_missing = True
Target critical business logic for 90%+ coverage; exclude migrations, settings, and configuration.