fix missing reason/name information for skipped tests
This commit is contained in:
parent
cf4e14baed
commit
3a9788fc6f
|
@ -1,6 +1,9 @@
|
|||
Changes between 2.0.2 and 2.0.3.dev
|
||||
----------------------------------------------
|
||||
|
||||
- fix missing skip reason/meta information in junitxml files, reported
|
||||
via http://lists.idyll.org/pipermail/testing-in-python/2011-March/003928.html
|
||||
|
||||
- fix issue34: avoid collection failure with "test" prefixed classes
|
||||
deriving from object.
|
||||
|
||||
|
|
|
@ -106,7 +106,13 @@ class LogXML(object):
|
|||
'<skipped message="expected test failure">%s</skipped>',
|
||||
report.keywords['xfail'])
|
||||
else:
|
||||
self.appendlog("<skipped/>")
|
||||
filename, lineno, skipreason = report.longrepr
|
||||
if skipreason.startswith("Skipped: "):
|
||||
skipreason = skipreason[9:]
|
||||
self.appendlog('<skipped type="pytest.skip" '
|
||||
'message="%s">%s</skipped>',
|
||||
skipreason, "%s:%s: %s" % report.longrepr,
|
||||
)
|
||||
self._closetestcase()
|
||||
self.skipped += 1
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
unit and functional testing with Python.
|
||||
"""
|
||||
__version__ = '2.0.3.dev2'
|
||||
__version__ = '2.0.3.dev3'
|
||||
__all__ = ['main']
|
||||
|
||||
from _pytest.core import main, UsageError, _preloadplugins
|
||||
|
|
2
setup.py
2
setup.py
|
@ -22,7 +22,7 @@ def main():
|
|||
name='pytest',
|
||||
description='py.test: simple powerful testing with Python',
|
||||
long_description = long_description,
|
||||
version='2.0.3.dev2',
|
||||
version='2.0.3.dev3',
|
||||
url='http://pytest.org',
|
||||
license='MIT license',
|
||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||
|
|
|
@ -58,6 +58,26 @@ class TestPython:
|
|||
assert_attr(fnode, message="test setup failure")
|
||||
assert "ValueError" in fnode.toxml()
|
||||
|
||||
def test_skip_contains_name_reason(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
def test_skip():
|
||||
pytest.skip("hello23")
|
||||
""")
|
||||
result, dom = runandparse(testdir)
|
||||
assert result.ret == 0
|
||||
node = dom.getElementsByTagName("testsuite")[0]
|
||||
assert_attr(node, skips=1)
|
||||
tnode = node.getElementsByTagName("testcase")[0]
|
||||
assert_attr(tnode,
|
||||
classname="test_skip_contains_name_reason",
|
||||
name="test_skip")
|
||||
snode = tnode.getElementsByTagName("skipped")[0]
|
||||
assert_attr(snode,
|
||||
type="pytest.skip",
|
||||
message="hello23",
|
||||
)
|
||||
|
||||
def test_classname_instance(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
class TestClass:
|
||||
|
|
Loading…
Reference in New Issue