February 2022
Intermediate to advanced
274 pages
6h 28m
English
With coverage.py, we are able to generate HTML reports to help view coverage data in more detail. The report is generated either by using the --cov-report=html flag, or by running coverage html after running a previous coverage run:
| | $ cd /path/to/code |
| | $ pytest --cov=cards --cov-report=html ch7 |
or
| | $ pytest --cov=cards ch7 |
| | $ coverage html |
Either command asks coverage.py to generate an HTML report. The report, called htmlcov/, is placed in the directory from which you ran the command.
Open htmlcov/index.html with a browser and you’ll see:

Clicking the api.py file shows a report ...
Read now
Unlock full access