in scripts/metric_reporter/parser/junit_xml_parser.py [0:0]
def _parse_test_suites(self, repository: str, artifact_file_name: str) -> JUnitXmlTestSuites:
def postprocessor(path, key, value):
key_mapping = {
"testsuite": "test_suites",
"testcase": "test_cases",
"system-out": "system_out", # Playwright
"disabled": "skipped", # Nextest skipped == disabled
"#text": "text",
}
key = key_mapping.get(key, key)
return key, value
content: str = self._gcs_client.get_junit_artifact_content(repository, artifact_file_name)
test_suites_dict: dict[str, Any] = xmltodict.parse(
content,
attr_prefix="",
postprocessor=postprocessor,
force_list=["test_suites", "test_cases", "property"],
)
adapter: TypeAdapter[JUnitXmlTestSuites] = TypeAdapter(JUnitXmlTestSuites)
test_suites: JUnitXmlTestSuites = adapter.validate_python(test_suites_dict["testsuites"])
return test_suites