Unit Testing/Pytest/View Test Coverage

Install Coverage
Install Coverage using either:

Use Coverage to Run Pytest
Run tests using Coverage to monitor test coverage: coverage run -m pytest

Generate a Coverage Report
Generate a coverage report: coverage report

Generate a coverage report with line numbers: coverage report -m

Generate a Coverage HTML Report
Generate a coverage HTML report: coverage html

Look for an  folder and open   in your browser. In the report, select  to view test coverage of the multiply function.

Customize the Coverage HTML Report
A  file is used to customize the location and content of the Coverage HTML report. For example, the following would omit any Python library files in the  folder, exclude   lines, and rename the   folder to. See Coverage documentation for more information.

[run] omit = */.local/*

[report] exclude_lines = pragma: no cover

[html] directory = coverage_report