reintroduce --junit - i think it is actually useful

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-07-07 14:43:31 +02:00
parent af5e18e26c
commit 37a2898f18
3 changed files with 13 additions and 11 deletions

View File

@ -28,11 +28,14 @@ New features
def test_function(arg): def test_function(arg):
... ...
- customizable error reporting: allow custom error reporting for - improved error reporting when collection errors appear.
custom (test and particularly collection) nodes by always calling In general, for custom (test and particularly collection)
``node.repr_failure(excinfo)`` which you may override to return a nodes ``node.repr_failure(excinfo)`` is now called so that you can
string error representation of your choice which is going to be override it to return a string error representation of your choice
reported as a (red) string. 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 Bug fixes / Maintenance
++++++++++++++++++++++++++ ++++++++++++++++++++++++++

View File

@ -11,15 +11,14 @@ def pytest_addoption(parser):
group.addoption('--junitxml', action="store", dest="xmlpath", group.addoption('--junitxml', action="store", dest="xmlpath",
metavar="path", default=None, metavar="path", default=None,
help="create junit-xml style report file at given path.") help="create junit-xml style report file at given path.")
# probalby YAGNI, therefore commented out: group.addoption('--junitprefix', action="store", dest="junitprefix",
#group.addoption('--junitprefix', action="store", dest="junitprefix", metavar="str", default=None,
# metavar="str", default=None, help="prepend prefix to classnames in junit-xml output")
# help="prepend prefix to classnames in junit-xml output")
def pytest_configure(config): def pytest_configure(config):
xmlpath = config.option.xmlpath xmlpath = config.option.xmlpath
if xmlpath: if xmlpath:
config._xml = LogXML(xmlpath, None) # config.option.junitprefix) config._xml = LogXML(xmlpath, config.option.junitprefix)
config.pluginmanager.register(config._xml) config.pluginmanager.register(config._xml)
def pytest_unconfigure(config): def pytest_unconfigure(config):

View File

@ -119,7 +119,7 @@ class TestPython:
classname="test_failure_escape.test_failure_escape", classname="test_failure_escape.test_failure_escape",
name="test_func[&]") name="test_func[&]")
def YAGNI_test_junit_prefixing(self, testdir): def test_junit_prefixing(self, testdir):
testdir.makepyfile(""" testdir.makepyfile("""
def test_func(): def test_func():
assert 0 assert 0