Pytest plugin for measuring coverage
open sourceMITfree
pytest-cov is a pytest plugin that measures code coverage with coverage.py while your tests run (pytest --cov). Compared with coverage run, it erases and combines .coverage files automatically and reports by default, supports detailed coverage contexts (the full test name as each line's context), works with pytest-xdist's distributed and remote testing, and keeps pytest's normal import behaviour. Every coverage.py feature is available through its command-line options or coverage's config file.
Problems it solves
- measure test coverage for my Python project with pytest
- get coverage reports when running tests in parallel with pytest-xdist
- fail CI when Python test coverage drops below a threshold
- see which test covered each line of my Python code
Features
- coverage while pytest runs (--cov)
- automatic erase and combine of .coverage files
- coverage contexts per test
- pytest-xdist support
- all coverage.py options and config
Alternatives
The same job
These do what pytest-cov does.
- Codecov More than just code coverage.
- SimpleCov Code coverage for Ruby with a powerful configuration library and automatic merging of coverage across test suites
- Coveralls We help you deliver code confidently by showing which parts of your code aren't covered by tests.
- DeepSource AI code review platform that combines static analysis with AI review agents
