pytest Tutorial – Part 3

Having your tests in place you certainly want to know how much of your code is actually tested by your tests.

This is called coverage.


pip install pytest-cov

Checking the coverage

pytest --cov=<module> test_<module>.py

HTML Reports

You can generate a nice html report from the test runs with

coverage html