Coverage.py API¶
The API to coverage.py is very simple, contained in a module called coverage.
Most of the interface is in the coverage.Coverage
class. Methods on
the Coverage object correspond roughly to operations available in the command
line interface. For example, a simple use would be:
import coverage
cov = coverage.Coverage()
cov.start()
# .. call your code ..
cov.stop()
cov.save()
cov.html_report()
The coverage.CoverageData
class provides access to coverage data
stored in coverage.py data files.