Python coverage: Difference between revisions
From wikinotes
(→Usage) |
|||
Line 1: | Line 1: | ||
= Documentation = | = Documentation = | ||
<blockquote> | <blockquote> | ||
{| | {| class="wikitable" | ||
|- | |||
| official docs || https://coverage.readthedocs.io/en/v4.5.x/ | | official docs || https://coverage.readthedocs.io/en/v4.5.x/ | ||
|- | |- | ||
|} | |} | ||
</blockquote><!-- Documentation --> | </blockquote><!-- Documentation --> |
Revision as of 03:42, 24 January 2022
Documentation
official docs https://coverage.readthedocs.io/en/v4.5.x/
Usage
# run coverage coverage run \ --source path/A \ --source path/B \ --omit path/C # combine coverage multiple reports into a single .coverage file coverage combine .coverage1 .coverage2 ... # produce XML report from a single .coverage file coverage xml # produce interactive HTML report (htmlcov/index.html) coverage html
Excluding Code
Append a comment to a line to exclude it. If that statement is a block of code, the entire block will be excluded.
if __name__ == '__main__': # pragma: no cover # not included in coverage report...