INNER CODE UNIT · Python
TestParseReport
apache/ozone · dev-support/ci/test_junit_summary.py:44
class TestParseReport(unittest.TestCase):
def write_report(self, tmp, relpath, content=SAMPLE_XML):
path = os.path.join(tmp, relpath)
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "w", encoding="utf-8") as f:
f.write(content)
return path
def test_classification(self):
with tempfile.TemporaryDirectory() as tmp:
path = self.write_report(tmp, "hadoop-hdds/common/target/surefire-reports/TEST-x.xml")
cases = junit_summary.parse_report(path)
by_name = {c.test_name: c for c in cases}
self.assertEqual(len(cases), 4)
self.assertEqual(by_name["testPasses"].status, "passed")
self.assertEqual(by_name["testFails"].status, "failed")
self.assertEqual(by_name["testFlaky"].status, "flaky")