cherrypy.lib.covercp module

Code-coverage tools for CherryPy.

To use this module, or the coverage tools in the test suite, you need to download ‘coverage.py’, either Gareth Rees’ original implementation or Ned Batchelder’s enhanced version:

To turn on coverage tracing, use the following code:

cherrypy.engine.subscribe('start', covercp.start)

DO NOT subscribe anything on the ‘start_thread’ channel, as previously recommended. Calling start once in the main thread should be sufficient to start coverage on all threads. Calling start again in each thread effectively clears any coverage data gathered up to that point.

Run your code, then use the covercp.serve() function to browse the results in a web browser. If you run this module from the command line, it will call serve() for you.

class cherrypy.lib.covercp.CoverStats(coverage, root=None)[source]

Bases: object

annotated_file(filename, statements, excluded, missing)[source]
index()[source]
menu(base='/', pct='50', showpct='', exclude='python\\d\\.\\d|test|tut\\d|tutorial')[source]
report(name)[source]
cherrypy.lib.covercp._graft(path, tree)[source]
cherrypy.lib.covercp._percent(statements, missing)[source]
cherrypy.lib.covercp._show_branch(root, base, path, pct=0, showpct=False, exclude='', coverage=<coverage.control.Coverage object>)[source]
cherrypy.lib.covercp._skip_file(path, exclude)[source]
cherrypy.lib.covercp.get_tree(base, exclude, coverage=<coverage.control.Coverage object>)[source]

Return covered module names as a nested dict.

cherrypy.lib.covercp.serve(path='/home/docs/checkouts/readthedocs.org/user_builds/cherrypy/envs/latest/lib/python3.6/site-packages/cherrypy/lib/coverage.cache', port=8080, root=None)[source]
cherrypy.lib.covercp.start()[source]