Related: Travis-CI examples
.travis.yml code coverage tests using
are a nice way to track code coverage.
The one-time setup is very similar to Travis-CI:
- Create a free coveralls.io account–using your Github credentials.
- add a repository to Coveralls
pytest-cov module is excellent for recursively testing coverage.
[run] cover_pylib = false omit = /home/travis/virtualenv/* */site-packages/* */bin/* [report] exclude_lines = pragma: no cover def __repr__ RuntimeError NotImplementedError FileNotFoundError ImportError
.travis.yml have a line like
after_success: - pytest --cov
Coverage on own computer
To help debug coverage issues, simply do the coverage test on your own computer, from Terminal:
pytest --cov --cov-report html firefox htmlcov/index.html
and then you can browse a color-highlighted version of each of your files, showing which lines were excluded, covered or not covered.