From 37a2898f185a56a332f754e7643479097fbbe048 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 7 Jul 2010 14:43:31 +0200 Subject: [PATCH] reintroduce --junit - i think it is actually useful --HG-- branch : trunk --- CHANGELOG | 13 ++++++++----- py/_plugin/pytest_junitxml.py | 9 ++++----- testing/plugin/test_pytest_junitxml.py | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index baeba321a..017201767 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -28,11 +28,14 @@ New features def test_function(arg): ... -- customizable error reporting: allow custom error reporting for - custom (test and particularly collection) nodes by always calling - ``node.repr_failure(excinfo)`` which you may override to return a - string error representation of your choice which is going to be - reported as a (red) string. +- improved error reporting when collection errors appear. + In general, for custom (test and particularly collection) + nodes ``node.repr_failure(excinfo)`` is now called so that you can + override it to return a string error representation of your choice + which is going to be reported as a (red) string. + +- introduce '--junitprefix=STR' option to prepend a prefix + to all reports in the junitxml file. Bug fixes / Maintenance ++++++++++++++++++++++++++ diff --git a/py/_plugin/pytest_junitxml.py b/py/_plugin/pytest_junitxml.py index de96db180..82910114e 100644 --- a/py/_plugin/pytest_junitxml.py +++ b/py/_plugin/pytest_junitxml.py @@ -11,15 +11,14 @@ def pytest_addoption(parser): group.addoption('--junitxml', action="store", dest="xmlpath", metavar="path", default=None, help="create junit-xml style report file at given path.") - # probalby YAGNI, therefore commented out: - #group.addoption('--junitprefix', action="store", dest="junitprefix", - # metavar="str", default=None, - # help="prepend prefix to classnames in junit-xml output") + group.addoption('--junitprefix', action="store", dest="junitprefix", + metavar="str", default=None, + help="prepend prefix to classnames in junit-xml output") def pytest_configure(config): xmlpath = config.option.xmlpath if xmlpath: - config._xml = LogXML(xmlpath, None) # config.option.junitprefix) + config._xml = LogXML(xmlpath, config.option.junitprefix) config.pluginmanager.register(config._xml) def pytest_unconfigure(config): diff --git a/testing/plugin/test_pytest_junitxml.py b/testing/plugin/test_pytest_junitxml.py index b44e2e80b..a0b97e5d6 100644 --- a/testing/plugin/test_pytest_junitxml.py +++ b/testing/plugin/test_pytest_junitxml.py @@ -119,7 +119,7 @@ class TestPython: classname="test_failure_escape.test_failure_escape", name="test_func[&]") - def YAGNI_test_junit_prefixing(self, testdir): + def test_junit_prefixing(self, testdir): testdir.makepyfile(""" def test_func(): assert 0