misc: update merge-junit-results.py

This commit is contained in:
Benjamin Dauvergne 2019-12-07 11:09:24 +01:00
parent 7e3a7a629c
commit 55995f8141
1 changed files with 8 additions and 5 deletions

View File

@ -36,10 +36,13 @@ def merge_results(xml_files):
for file_name in xml_files:
tree = ET.parse(file_name)
test_suite = tree.getroot()
failures += int(test_suite.attrib['failures'])
tests += int(test_suite.attrib['tests'])
errors += int(test_suite.attrib['errors'])
time += float(test_suite.attrib['time'])
failures += int(test_suite.attrib.get('failures', '0'))
tests += int(test_suite.attrib.get('tests', '0'))
errors += int(test_suite.attrib.get('errors', '0'))
time += float(test_suite.attrib.get('time', '0.'))
name = test_suite.attrib.get('name', '')
for child in test_suite.getchildren():
child.attrib['classname'] = '%s-%s' % (name, child.attrib.get('classname', ''))
cases.append(test_suite.getchildren())
new_root = ET.Element('testsuite')
@ -55,7 +58,7 @@ def merge_results(xml_files):
def usage():
this_file = os.path.basename(__file__)
print 'Usage: %s results1.xml results2.xml' % this_file
print('Usage: %s results1.xml results2.xml' % this_file)
if __name__ == '__main__':