AUT: Cards (To-Do List)
Installation: pip install pytest-cov
Coverage command: pytest --cov=cards --cov-report=term-missing <test_path>
--cov={path to the code or the installed package you're testing}
Installation: pip install coverage
Coverage command: coverage run --source=cards -m pytest <test_path>
Report: coverage report --show-missing
Coverage spec file:
[paths]
source =
path_1
path_2
pytest --cov=cards --cov-report=html <test_path>
or:
pytest --cov=cards <test_path>
coverage html
Code blocks can be excluded from testing with pragma
statement.
def main():
...
if __name__ == "__main__": # pragma: no cover
main()