# HG changeset patch -- Bitbucket.org # Project pytest-coverage # URL http://bitbucket.org/prologic/pytest-coverage/overview/ # User holger krekel <hol...@merlinux.eu> # Date 1265829453 -3600 # Node ID 095abe9bfebecef74084405ba398baa9ee8c4be2 # Parent 845817424bc2c61af51eee7332bb8a568c46cc63 removing old figleaf file to unconfuse
--- a/pytest_figleaf.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -report test coverage using the 'figleaf' package. - -Install ---------------- - -To install the plugin issue:: - - easy_install pytest-figleaf # or - pip install pytest-figleaf - -and if you are using pip you can also uninstall:: - - pip uninstall pytest-figleaf - - -Usage ---------------- - -After installation you can simply type:: - - py.test --figleaf [...] - -to enable figleaf coverage in your test run. A default ".figleaf" data file -and "html" directory will be created. You can use command line options -to control where data and html files are created. - -""" - -__version__ = "1.0" - -import py - -def pytest_addoption(parser): - group = parser.getgroup('figleaf based coverage reporting') - group.addoption('--figleaf', action='store_true', default=False, - dest = 'figleaf', - help=('trace python coverage with figleaf and write HTML ' - 'for files below the current working dir')) - group.addoption('--fig-data', action='store', default='.figleaf', - dest='figleafdata', metavar="dir", - help='set tracing file, default: ".figleaf".') - group.addoption('--fig-html', action='store', default='html', - dest='figleafhtml', metavar="dir", - help='set html reporting dir, default "html".') - -def pytest_configure(config): - if config.getvalue("figleaf"): - import figleaf - figleaf.start() - -def pytest_terminal_summary(terminalreporter): - config = terminalreporter.config - if not config.getvalue("figleaf"): - return - import figleaf.annotate_html - datafile = py.path.local(config.getvalue('figleafdata')) - tw = terminalreporter._tw - tw.sep('-', 'figleaf') - tw.line('Writing figleaf data to %s' % (datafile)) - figleaf.stop() - figleaf.write_coverage(str(datafile)) - coverage = get_coverage(datafile, config) - reportdir = py.path.local(config.getvalue('figleafhtml')) - tw.line('Writing figleaf html to file://%s' % (reportdir)) - figleaf.annotate_html.prepare_reportdir(str(reportdir)) - exclude = [] - figleaf.annotate_html.report_as_html(coverage, - str(reportdir), exclude, {}) - -def get_coverage(datafile, config): - import figleaf.annotate_html - # basepath = config.topdir - basepath = py.path.local() - data = figleaf.read_coverage(str(datafile)) - d = {} - coverage = figleaf.combine_coverage(d, data) - for path in coverage.keys(): - if not py.path.local(path).relto(basepath): - del coverage[path] - return coverage _______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn