In this PR I add code coverage reporting. I find it helpful to see code coverage results when writing tests and reviewing PRs. I thought this addition might be useful for the library.
What
I added a new library, pytest-cov, which makes it easy to tie the standard coverage.py tool in with pytest.
I took the opportunity to also bump the pytest library to the latest version.
I added some configuration defaults to generate html, xml, and term reports.
Testing
ensure to pip install the new requirements
Run pytest
Tests should pass and show a terminal report of the code coverage for each file
There should be a .reports folder with the HTML version of the coverage report, as well as a xml version
---------- coverage: platform darwin, python 3.11.3-final-0 ----------
Name Stmts Miss Branch BrPart Cover
-----------------------------------------------------------
closeio_api/__init__.py 111 22 39 7 75%
closeio_api/utils.py 3 0 0 0 100%
-----------------------------------------------------------
TOTAL 114 22 39 7 76%
Coverage HTML written to dir .reports/htmlcov
Coverage XML written to file .reports/coverage.xml
Why
In this PR I add code coverage reporting. I find it helpful to see code coverage results when writing tests and reviewing PRs. I thought this addition might be useful for the library.
What
pytest-cov
, which makes it easy to tie the standard coverage.py tool in with pytest.Testing
pytest
.reports
folder with the HTML version of the coverage report, as well as a xml version