pytest-cov
A pytest plugin that runs coverage.py during the test run and prints a coverage report at the end.
In more detail
The --cov option names the code to measure and --cov-report=term-missing adds a Missing column listing the line numbers that never ran. The plugin shows up in the plugins line of the pytest session header.
Example
pytest -q --cov=refund --cov-report=term-missingRelated terms
- coverage.py — The standard Python tool for measuring code coverage, which records which lines and branches ran.
- code coverage — A measurement of which parts of your code ran while the tests ran.
- plugin — An add-on package that extends a tool with extra features without changing the tool itself.
Taught in
- Coverage: Diagnostic, Not Target — Automated Testing, TDD & Quality Engineering
- Introducing pytest — Automated Testing, TDD & Quality Engineering