Package cherrypy :: Package lib :: Module covercp
[hide private]
[frames] | no frames]

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.on_start_engine_list.insert(0, covercp.start)
    cherrypy.engine.on_start_thread_list.insert(0, covercp.start)

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.



Classes [hide private]
  CoverStats
Functions [hide private]
 
start(threadid=None) source code
 
_percent(statements, missing) source code
 
_show_branch(root, base, path, pct=0, showpct=False, exclude='') source code
 
_skip_file(path, exclude) source code
 
_graft(path, tree) source code
 
get_tree(base, exclude)
Return covered module names as a nested dict.
source code
 
serve(path='/tmp/buildd/cherrypy3-3.0.2/cherrypy/lib/coverage.cache', port=8080) source code
Variables [hide private]
  localFile = '/tmp/buildd/cherrypy3-3.0.2/cherrypy/lib/coverage...
  coverage = None
  initial_base = '/tmp/buildd/cherrypy3-3.0.2/cherrypy'
  TEMPLATE_MENU = '<html>\n<head>\n <title>CherryPy Coverage ...
  TEMPLATE_FORM = '\n<div id="options">\n<form action=\'menu\' m...
  TEMPLATE_FRAMESET = '<html>\n<head><title>CherryPy coverage da...
  TEMPLATE_COVERAGE = '<html>\n<head>\n <title>Coverage for %...
  TEMPLATE_LOC_COVERED = '<tr class="covered">\n <td class="l...
  TEMPLATE_LOC_NOT_COVERED = '<tr class="notcovered">\n <td c...
  TEMPLATE_LOC_EXCLUDED = '<tr class="excluded">\n <td class=...
  TEMPLATE_ITEM = '%s%s<a class=\'file\' href=\'report?name=%s\'...
  __warningregistry__ = {('No code coverage will be performed; c...
Variables Details [hide private]

localFile

Value:
'/tmp/buildd/cherrypy3-3.0.2/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=\'showp\
ct\' value=\'checked\' /><br />
    Hide files over <input type=\'text\' id=\'pct\' name=\'pct\' value\
=\'%(pct)s\' size=\'3\' />%%<br />
...

TEMPLATE_FRAMESET

Value:
'''<html>
<head><title>CherryPy coverage data</title></head>
<frameset cols=\'250, 1*\'>
    <frame src=\'menu?base=/tmp/buildd/cherrypy3-3.0.2/cherrypy\' />
    <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&nbsp;</td>
    <td>%s</td>
</tr>
'''

TEMPLATE_LOC_NOT_COVERED

Value:
'''<tr class="notcovered">
    <td class="lineno">%s&nbsp;</td>
    <td>%s</td>
</tr>
'''

TEMPLATE_LOC_EXCLUDED

Value:
'''<tr class="excluded">
    <td class="lineno">%s&nbsp;</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.',
  <class exceptions.UserWarning at 0x401c4e6c>,
  43): 1}