jenkins: don't assume presence of optional data in test results (#38266)

This commit is contained in:
Paul Marillonnet 2019-12-06 14:21:24 +01:00
parent 211262eb78
commit afe09ee7b3
1 changed files with 4 additions and 4 deletions

View File

@ -36,10 +36,10 @@ 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', ''))