finalize nodereporters by throwing away the intermediate xml nodes, fixes issue #1074

This commit is contained in:
Ronny Pfannschmidt 2015-10-10 19:44:14 +02:00
parent 5f5a7995b9
commit 518c88f149
1 changed files with 8 additions and 0 deletions

View File

@ -184,6 +184,12 @@ class _NodeReporter(object):
self._write_captured_output(report)
def finalize(self):
data = self.to_xml().unicode(indent=0)
self.__dict__.clear()
self.to_xml = lambda: py.xml.raw(data)
@pytest.fixture
def record_xml_property(request):
"""Fixture that adds extra xml properties to the tag for the calling test.
@ -312,6 +318,8 @@ class LogXML(object):
reporter = self._opentestcase(report)
reporter.append_skipped(report)
self.update_testcase_duration(report)
if report.when == "teardown":
self.nodereporter(report.nodeid).finalize()
def update_testcase_duration(self, report):
"""accumulates total duration for nodeid from given report and updates