# 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)

  Bases: `object`

  annotated_file(filename, statements, excluded, missing)
  index()
  menu(base='/', pct='50', showpct='', exclude='python\\d\\.\\d|test|tut\\d|tutorial')
  report(name)

cherrypy.lib.covercp._graft(path, tree)

cherrypy.lib.covercp._percent(statements, missing)

cherrypy.lib.covercp._show_branch(root, base, path, pct=0, showpct=False, exclude='', coverage=None)

cherrypy.lib.covercp._skip_file(path, exclude)

cherrypy.lib.covercp.get_tree(base, exclude, coverage=None)

  Return covered module names as a nested dict.

cherrypy.lib.covercp.serve(path='/build/cherrypy3-gfcGRg/cherrypy3-18.10.0/cherrypy/lib/coverage.cache', port=8080, root=None)

cherrypy.lib.covercp.start()