remove figleaf which now lives "outside"

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-01-13 00:47:20 +01:00
parent 59f3adb46b
commit d4f5073076
9 changed files with 26 additions and 110 deletions

View File

@ -22,6 +22,7 @@ plugins = [
externals = {
'oejskit': "run javascript tests in real life browsers",
'figleaf': "for testing with Titus' figleaf coverage module",
'django': "for testing django applications",
'coverage': "for testing with Ned's coverage module ",
'xmlresult': "for generating xml reports "
@ -137,7 +138,7 @@ class PluginOverview(RestWriter):
docpath = self.target.dirpath(name).new(ext=".txt")
if oneliner is not None:
htmlpath = docpath.new(ext='.html')
self.para("%s_ (3rd) %s" %(name, oneliner))
self.para("%s_ (external) %s" %(name, oneliner))
self.add_internal_link(name, htmlpath)
else:
doc = PluginDoc(docpath)

View File

@ -1,33 +1,17 @@
pytest_figleaf plugin
=====================
report python test coverage using the 'figleaf' package.
add options to drive and report python test coverage using the 'figleaf' package.
.. contents::
:local:
Install the `pytest-figleaf`_ plugin to use figleaf coverage testing::
Not enabled by default (use "-p" or conftest settings to do so).
easy_install pytest-figleaf
command line options
--------------------
or::
pip install pytest-figleaf
``--figleaf``
trace python coverage with figleaf and write HTML for files below the current working dir
``--fig-data=dir``
set tracing file, default: ".figleaf".
``--fig-html=dir``
set html reporting dir, default "html".
This will make py.test have figleaf related options.
Start improving this plugin in 30 seconds
=========================================
.. _`pytest-figleaf`: http://bitbucket.org/hpk42/pytest-figleaf/
1. Download `pytest_figleaf.py`_ plugin source code
2. put it somewhere as ``pytest_figleaf.py`` into your import path
3. a subsequent ``py.test`` run will use your local version
Checkout customize_, other plugins_ or `get in contact`_.
.. include:: links.txt

View File

@ -17,6 +17,12 @@ command line options
display py lib version and import information.
``-p name``
early-load given plugin (multi-allowed).
``--traceconfig``
trace considerations of conftest.py files.
``--nomagic``
don't reinterpret asserts, no traceback cutting.
``--debug``
generate and show internal debugging information.
``--help-config``
show available conftest.py and ENV-variable names.

View File

@ -115,6 +115,9 @@ hook specification sourcecode
# hooks for influencing reporting (invoked from pytest_terminal)
# -------------------------------------------------------------------------
def pytest_report_header(config):
""" return a string to be displayed as header info for terminal reporting."""
def pytest_report_teststatus(report):
""" return result-category, shortletter and verbose word for reporting."""
pytest_report_teststatus.firstresult = True

View File

@ -8,9 +8,9 @@ mark_ generic mechanism for marking python functions.
pdb_ interactive debugging with the Python Debugger.
figleaf_ report python test coverage using the 'figleaf' package.
figleaf_ (external) for testing with Titus' figleaf coverage module
coverage_ (3rd) for testing with Ned's coverage module
coverage_ (external) for testing with Ned's coverage module
monkeypatch_ safely patch object attributes, dicts and environment variables.
@ -24,9 +24,9 @@ tmpdir_ provide temporary directories to test functions.
testing domains
===============
oejskit_ (3rd) run javascript tests in real life browsers
oejskit_ (external) run javascript tests in real life browsers
django_ (3rd) for testing django applications
django_ (external) for testing django applications
genscript_ generate standalone test script to be distributed along with an application.
@ -38,7 +38,7 @@ pastebin_ submit failure or test session information to a pastebin service.
logxml_ logging of test results in JUnit-XML format, for use with Hudson
xmlresult_ (3rd) for generating xml reports and CruiseControl integration
xmlresult_ (external) for generating xml reports and CruiseControl integration
resultlog_ non-xml machine-readable logging of test results.

View File

@ -1,5 +1,5 @@
.. _`pytest_logxml.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.2.0a1/py/plugin/pytest_logxml.py
.. _`terminal`: terminal.html
.. _`helpconfig`: helpconfig.html
.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.2.0a1/py/plugin/pytest_recwarn.py
.. _`unittest`: unittest.html
.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.2.0a1/py/plugin/pytest_monkeypatch.py
@ -17,10 +17,9 @@
.. _`restdoc`: restdoc.html
.. _`pytest_pastebin.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.2.0a1/py/plugin/pytest_pastebin.py
.. _`pytest_tmpdir.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.2.0a1/py/plugin/pytest_tmpdir.py
.. _`pytest_figleaf.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.2.0a1/py/plugin/pytest_figleaf.py
.. _`terminal`: terminal.html
.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.2.0a1/py/plugin/pytest_hooklog.py
.. _`logxml`: logxml.html
.. _`helpconfig`: helpconfig.html
.. _`pytest_skipping.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.2.0a1/py/plugin/pytest_skipping.py
.. _`checkout the py.test development version`: ../../install.html#checkout
.. _`pytest_helpconfig.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.2.0a1/py/plugin/pytest_helpconfig.py

View File

@ -23,12 +23,6 @@ command line options
traceback verboseness (long/short/no).
``--fulltrace``
don't cut any tracebacks (default is to cut).
``--traceconfig``
trace considerations of conftest.py files.
``--nomagic``
don't reinterpret asserts, no traceback cutting.
``--debug``
generate and show internal debugging information.
Start improving this plugin in 30 seconds
=========================================

View File

@ -1,54 +0,0 @@
"""
report python test coverage using the 'figleaf' package.
Not enabled by default (use "-p" or conftest settings to do so).
"""
import py
py.test.importorskip("figleaf")
import figleaf.annotate_html
def pytest_addoption(parser):
group = parser.getgroup('figleaf options')
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"):
figleaf.start()
def pytest_terminal_summary(terminalreporter):
config = terminalreporter.config
if not config.getvalue("figleaf"):
return
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):
# 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

View File

@ -1,17 +0,0 @@
import py
def test_functional(testdir):
py.test.importorskip("figleaf")
testdir.makepyfile("""
def f():
x = 42
def test_whatever():
pass
""")
result = testdir.runpytest('--figleaf')
assert result.ret == 0
assert result.stdout.fnmatch_lines([
'*figleaf html*'
])
#print result.stdout.str()