diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py index ec6c25eef..e6364f7c7 100644 --- a/_pytest/junitxml.py +++ b/_pytest/junitxml.py @@ -132,8 +132,6 @@ class _NodeReporter(object): tag = getattr(Junit, 'system-' + capname) self.append(tag(bin_xml_escape(allcontent))) - - def append_pass(self, report): self.add_stats('passed') self._write_captured_output(report) @@ -257,6 +255,7 @@ class LogXML(object): 'skipped', ], 0) self.nodereporters = {} # nodeid -> _NodeReporter + self.nodereporters_ordered = [] def nodereporter(self, nodeid): if nodeid in self.nodereporters: @@ -264,6 +263,7 @@ class LogXML(object): return self.nodereporters[nodeid] reporter = _NodeReporter(nodeid, self) self.nodereporters[nodeid] = reporter + self.nodereporters_ordered.append(reporter) return reporter def add_stats(self, key): @@ -348,7 +348,7 @@ class LogXML(object): logfile.write('') logfile.write(Junit.testsuite( - [x.to_xml() for x in self.nodereporters.values()], + [x.to_xml() for x in self.nodereporters_ordered], name="pytest", errors=self.stats['error'], failures=self.stats['failure'], diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 6ef0e4aa9..bc9df28a9 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -12,7 +12,6 @@ import pytest def runandparse(testdir, *args): resultpath = testdir.tmpdir.join("junit.xml") result = testdir.runpytest("--junitxml=%s" % resultpath, *args) - print(resultpath.read()) xmldoc = minidom.parse(str(resultpath)) return result, DomNode(xmldoc) @@ -61,6 +60,7 @@ class DomNode(object): return node.value def assert_attr(self, **kwargs): + __tracebackhide__ = True return assert_attr(self.__node, **kwargs) def toxml(self):