Module covercp
source code
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
<http://www.garethrees.org/2001/12/04/python-coverage/>`_ or Ned
Batchelder's `enhanced version:
<http://www.nedbatchelder.com/code/modules/coverage.html>`_
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.
|
|
|
|
|
_show_branch(root,
base,
path,
pct=0,
showpct=False,
exclude='
' ,
coverage=None) |
source code
|
|
|
|
|
|
|
get_tree(base,
exclude,
coverage=None)
Return covered module names as a nested dict. |
source code
|
|
|
serve(path=' /build/buildd/cherrypy3-3.3.0/cherrypy/lib/coverage.cache ' ,
port=8080,
root=None) |
source code
|
|
localFile
- Value:
' /build/buildd/cherrypy3-3.3.0/cherrypy/lib/coverage.cache '
|
|
TEMPLATE_MENU
- Value:
''' <html>
<head>
<title>CherryPy Coverage Menu</title>
<style>
body {font: 9pt Arial, serif;}
#tree {
font-size: 8pt;
font-family: Andale Mono, monospace;
...
|
|
TEMPLATE_FORM
- Value:
'''
<div id="options">
<form action=\'menu\' method=GET>
<input type=\'hidden\' name=\'base\' value=\'%(base)s\' />
Show percentages
<input type=\'checkbox\' %(showpct)s name=\'showpct\' value=\'chec
ked\' /><br />
Hide files over
...
|
|
TEMPLATE_FRAMESET
- Value:
''' <html>
<head><title>CherryPy coverage data</title></head>
<frameset cols=\'250, 1*\'>
<frame src=\'menu?base=%s\' />
<frame name=\'main\' src=\'\' />
</frameset>
</html>
'''
|
|
TEMPLATE_COVERAGE
- Value:
''' <html>
<head>
<title>Coverage for %(name)s</title>
<style>
h2 { margin-bottom: .25em; }
p { margin: .25em; }
.covered { color: #000; background-color: #fff; }
.notcovered { color: #fee; background-color: #500; }
...
|
|
TEMPLATE_LOC_COVERED
- Value:
''' <tr class="covered">
<td class="lineno">%s </td>
<td>%s</td>
</tr>
'''
|
|
TEMPLATE_LOC_NOT_COVERED
- Value:
''' <tr class="notcovered">
<td class="lineno">%s </td>
<td>%s</td>
</tr>
'''
|
|
TEMPLATE_LOC_EXCLUDED
- Value:
''' <tr class="excluded">
<td class="lineno">%s </td>
<td>%s</td>
</tr>
'''
|
|
TEMPLATE_ITEM
- Value:
''' %s%s<a class=\'file\' href=\'report?name=%s\' target=\'main\'>%s</a
>
'''
|
|
__warningregistry__
- Value:
{ ( ' No code coverage will be performed; coverage.py could not be import
ed. ' ,
<type 'exceptions.UserWarning'>,
45) : True}
|
|