reintroduce junitxml report order and debug cleanups
This commit is contained in:
parent
0528e5b45f
commit
5f5a7995b9
|
@ -132,8 +132,6 @@ class _NodeReporter(object):
|
||||||
tag = getattr(Junit, 'system-' + capname)
|
tag = getattr(Junit, 'system-' + capname)
|
||||||
self.append(tag(bin_xml_escape(allcontent)))
|
self.append(tag(bin_xml_escape(allcontent)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def append_pass(self, report):
|
def append_pass(self, report):
|
||||||
self.add_stats('passed')
|
self.add_stats('passed')
|
||||||
self._write_captured_output(report)
|
self._write_captured_output(report)
|
||||||
|
@ -257,6 +255,7 @@ class LogXML(object):
|
||||||
'skipped',
|
'skipped',
|
||||||
], 0)
|
], 0)
|
||||||
self.nodereporters = {} # nodeid -> _NodeReporter
|
self.nodereporters = {} # nodeid -> _NodeReporter
|
||||||
|
self.nodereporters_ordered = []
|
||||||
|
|
||||||
def nodereporter(self, nodeid):
|
def nodereporter(self, nodeid):
|
||||||
if nodeid in self.nodereporters:
|
if nodeid in self.nodereporters:
|
||||||
|
@ -264,6 +263,7 @@ class LogXML(object):
|
||||||
return self.nodereporters[nodeid]
|
return self.nodereporters[nodeid]
|
||||||
reporter = _NodeReporter(nodeid, self)
|
reporter = _NodeReporter(nodeid, self)
|
||||||
self.nodereporters[nodeid] = reporter
|
self.nodereporters[nodeid] = reporter
|
||||||
|
self.nodereporters_ordered.append(reporter)
|
||||||
return reporter
|
return reporter
|
||||||
|
|
||||||
def add_stats(self, key):
|
def add_stats(self, key):
|
||||||
|
@ -348,7 +348,7 @@ class LogXML(object):
|
||||||
|
|
||||||
logfile.write('<?xml version="1.0" encoding="utf-8"?>')
|
logfile.write('<?xml version="1.0" encoding="utf-8"?>')
|
||||||
logfile.write(Junit.testsuite(
|
logfile.write(Junit.testsuite(
|
||||||
[x.to_xml() for x in self.nodereporters.values()],
|
[x.to_xml() for x in self.nodereporters_ordered],
|
||||||
name="pytest",
|
name="pytest",
|
||||||
errors=self.stats['error'],
|
errors=self.stats['error'],
|
||||||
failures=self.stats['failure'],
|
failures=self.stats['failure'],
|
||||||
|
|
|
@ -12,7 +12,6 @@ import pytest
|
||||||
def runandparse(testdir, *args):
|
def runandparse(testdir, *args):
|
||||||
resultpath = testdir.tmpdir.join("junit.xml")
|
resultpath = testdir.tmpdir.join("junit.xml")
|
||||||
result = testdir.runpytest("--junitxml=%s" % resultpath, *args)
|
result = testdir.runpytest("--junitxml=%s" % resultpath, *args)
|
||||||
print(resultpath.read())
|
|
||||||
xmldoc = minidom.parse(str(resultpath))
|
xmldoc = minidom.parse(str(resultpath))
|
||||||
return result, DomNode(xmldoc)
|
return result, DomNode(xmldoc)
|
||||||
|
|
||||||
|
@ -61,6 +60,7 @@ class DomNode(object):
|
||||||
return node.value
|
return node.value
|
||||||
|
|
||||||
def assert_attr(self, **kwargs):
|
def assert_attr(self, **kwargs):
|
||||||
|
__tracebackhide__ = True
|
||||||
return assert_attr(self.__node, **kwargs)
|
return assert_attr(self.__node, **kwargs)
|
||||||
|
|
||||||
def toxml(self):
|
def toxml(self):
|
||||||
|
|
Loading…
Reference in New Issue