fix xml generation for skipped collections of tests
--HG-- branch : trunk
This commit is contained in:
parent
9fa6ca885a
commit
eb4249322e
|
@ -76,6 +76,15 @@ class LogXML(object):
|
|||
self._closetestcase()
|
||||
self.errors += 1
|
||||
|
||||
def append_collect_skipped(self, report):
|
||||
self._opentestcase_collectfailure(report)
|
||||
s = py.xml.escape(str(report.longrepr))
|
||||
#msg = str(report.longrepr.reprtraceback.extraline)
|
||||
self.test_logs.append(
|
||||
'<skipped message="collection skipped">%s</skipped>' % (s))
|
||||
self._closetestcase()
|
||||
self.skipped += 1
|
||||
|
||||
def append_error(self, report):
|
||||
self._opentestcase(report)
|
||||
s = py.xml.escape(str(report.longrepr))
|
||||
|
@ -130,7 +139,7 @@ class LogXML(object):
|
|||
logfile = open(self.logfile, 'w', 1) # line buffered
|
||||
suite_stop_time = time.time()
|
||||
suite_time_delta = suite_stop_time - self.suite_start_time
|
||||
numtests = self.passed + self.skipped + self.failed
|
||||
numtests = self.passed + self.failed
|
||||
logfile.write('<testsuite ')
|
||||
logfile.write('name="" ')
|
||||
logfile.write('errors="%i" ' % self.errors)
|
||||
|
|
|
@ -28,7 +28,7 @@ class TestPython:
|
|||
result, dom = runandparse(testdir)
|
||||
assert result.ret
|
||||
node = dom.getElementsByTagName("testsuite")[0]
|
||||
assert_attr(node, errors=0, failures=1, skips=1, tests=3)
|
||||
assert_attr(node, errors=0, failures=1, skips=1, tests=2)
|
||||
|
||||
def test_setup_error(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
|
@ -90,6 +90,19 @@ class TestPython:
|
|||
assert_attr(fnode, message="collection failure")
|
||||
assert "invalid syntax" in fnode.toxml()
|
||||
|
||||
def test_collect_skipped(self, testdir):
|
||||
testdir.makepyfile("import py ; py.test.skip('xyz')")
|
||||
result, dom = runandparse(testdir)
|
||||
assert not result.ret
|
||||
node = dom.getElementsByTagName("testsuite")[0]
|
||||
assert_attr(node, skips=1, tests=0)
|
||||
tnode = node.getElementsByTagName("testcase")[0]
|
||||
assert_attr(tnode,
|
||||
#classname="test_collect_error",
|
||||
name="test_collect_skipped")
|
||||
fnode = tnode.getElementsByTagName("skipped")[0]
|
||||
assert_attr(fnode, message="collection skipped")
|
||||
|
||||
class TestNonPython:
|
||||
def test_summing_simple(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
|
|
Loading…
Reference in New Issue