INNER CODE UNIT · Python
parse_report
apache/ozone · dev-support/ci/junit_summary.py:77
def parse_report(xml_path):
module = module_name(xml_path)
cases = []
for testcase in ET.parse(xml_path).getroot().iter("testcase"):
failure = next((c for c in testcase if c.tag in FAIL_TAGS), None)
flaky = next((c for c in testcase if c.tag in FLAKY_TAGS), None)
skipped = next((c for c in testcase if c.tag == "skipped"), None)
status, message = "passed", ""
if failure is not None:
status, message = "failed", clean_message(failure)
elif flaky is not None:
status, message = "flaky", clean_message(flaky)
elif skipped is not None:
status = "skipped"
cases.append(TestCase(module, testcase.get("classname") or "", testcase.get("name") or "",
float(testcase.get("time") or 0), status, message))
return cases