def pytest_sessionfinish(self): dirname = os.path.dirname(os.path.abspath(self.logfile)) if not os.path.isdir(dirname): os.makedirs(dirname) logfile = open(self.logfile, 'w', encoding='utf-8') suite_stop_time = time.time() suite_time_delta = suite_stop_time - self.suite_start_time numtests = (self.stats['passed'] + self.stats['failure'] + self.stats['skipped'] + self.stats['error'] - self.cnt_double_fail_tests) logfile.write('<?xml version="1.0" encoding="utf-8"?>') logfile.write( Junit.testsuite( self._get_global_properties_node(), [py.xml.raw(x) for x in synchronization['node_reporters'] ], # Synchronization name=self.suite_name, errors=self.stats['error'], failures=self.stats['failure'], skips=self.stats['skipped'], tests=numtests, time="%.3f" % suite_time_delta).unicode(indent=0)) logfile.close()
def pytest_sessionfinish(self): dirname = os.path.dirname(os.path.abspath(self.logfile)) if not os.path.isdir(dirname): os.makedirs(dirname) logfile = open(self.logfile, 'w', encoding='utf-8') suite_stop_time = time.time() suite_time_delta = suite_stop_time - self.suite_start_time numtests = (self.stats['passed'] + self.stats['failure'] + self.stats['skipped'] + self.stats['error'] - self.cnt_double_fail_tests) # print("NODE REPORTS: " + str(NODEREPORTS)) logfile.write('<?xml version="1.0" encoding="utf-8"?>') logfile.write( Junit.testsuite( self._get_global_properties_node(), [ self.concurrent_log_to_xml(x) for x in MultiProcessMode.NODEREPORTS ], name=self.suite_name, errors=self.stats['error'], failures=self.stats['failure'], skips=self.stats['skipped'], tests=numtests, time="%.3f" % suite_time_delta, ).unicode(indent=0)) logfile.close()
def to_xml(self): # overriden testcase = Junit.testcase(time=self.duration, **self.attrs) testcase.append(self.make_properties_node()) for node in self.nodes: testcase.append(node) return str(testcase.unicode(indent=0))