Python Code Coverage
Python code coverage can be done with coverage.py, to install:
pip install coverage
To run the coverage for auto discover:
# Run the unit tests.
coverage run -m unittest discover
# Generate coverage report.
coverage report --omit="*/site-packages/*,tests/*,*__init__*"
# Generate html coverage report.
coverage html --omit="*/site-packages/*,tests/*,*__init__*"
# open htmlcov/index.html
By default, coverage generates report for dependent package as well, so that we ignore */site-packages/*.