Loading scripts/parse_xml_report.py +40 −29 Original line number Diff line number Diff line Loading @@ -49,6 +49,38 @@ EVS_CATEGORIES = { NO_CATEGORIES = {"N/A": r".*"} def get_format_from_fulltestname(fulltestname: str) -> str: # For the format, favor the earliest match in the test case name fmt = min( [ (f, re.search(FORMATS[f], fulltestname, re.IGNORECASE).end()) for f in FORMATS if re.search(FORMATS[f], fulltestname, re.IGNORECASE) is not None ], key=lambda x: x[1], )[0] return fmt def get_category_from_fulltestname(fulltestname: str) -> str: cat = [ c for c in CATEGORIES if re.search(CATEGORIES[c], fulltestname, re.IGNORECASE) ][-1] return cat def get_testresult(testcase: ElementTree.Element) -> str: if testcase.find("failure") is not None: testresult = "FAIL" elif testcase.find("error") is not None: testresult = "ERROR" else: testresult = "PASS" return testresult # Main routine if __name__ == "__main__": parser = argparse.ArgumentParser( Loading Loading @@ -116,26 +148,15 @@ if __name__ == "__main__": testcases = [tc for tc in testcases if tc.find(".//skipped") is not None] for testcase in testcases: if testcase.get("file") is None: fulltestname = ( testcase.get("classname").replace(".", "/") + ".py::" + testcase.get("name") filename = testcase.get( "file", testcase.get("classname").replace(".", "/") + ".py" ) else: fulltestname = testcase.get("file") + "::" + testcase.get("name") fulltestname = filename + "::" + testcase.get("name") properties_found = { p.get("name"): p.get("value") for p in testcase.findall(".//property") } if testcase.find("failure") is not None: testresult = "FAIL" elif testcase.find("error") is not None: testresult = "ERROR" else: testresult = "PASS" # Extract number of splits, if any splits = [p.split("_")[-1] for p in properties_found if "split" in p] splits = list(dict.fromkeys(splits)) # Remove duplicates, keeping order Loading @@ -152,21 +173,11 @@ if __name__ == "__main__": # Identify format and category (mode of operation) # For the format, favor the earliest match in the test case name fmt = min( [ (f, re.search(FORMATS[f], fulltestname, re.IGNORECASE).end()) for f in FORMATS if re.search(FORMATS[f], fulltestname, re.IGNORECASE) ], key=lambda x: x[1], )[0] fmt = get_format_from_fulltestname(fulltestname) # Note that only one category is selected, even though several may match, e.g. bitrate switching + JBM. Here the last match is picked. cat = [ c for c in CATEGORIES if re.search(CATEGORIES[c], fulltestname, re.IGNORECASE) ][-1] cat = get_category_from_fulltestname(fulltestname) testresult = get_testresult(testcase) # For ERROR cases, both a FAIL and an ERROR result is generated. # Here, a FAIL would be overwritten with an ERROR result since it has the same name. Loading Loading
scripts/parse_xml_report.py +40 −29 Original line number Diff line number Diff line Loading @@ -49,6 +49,38 @@ EVS_CATEGORIES = { NO_CATEGORIES = {"N/A": r".*"} def get_format_from_fulltestname(fulltestname: str) -> str: # For the format, favor the earliest match in the test case name fmt = min( [ (f, re.search(FORMATS[f], fulltestname, re.IGNORECASE).end()) for f in FORMATS if re.search(FORMATS[f], fulltestname, re.IGNORECASE) is not None ], key=lambda x: x[1], )[0] return fmt def get_category_from_fulltestname(fulltestname: str) -> str: cat = [ c for c in CATEGORIES if re.search(CATEGORIES[c], fulltestname, re.IGNORECASE) ][-1] return cat def get_testresult(testcase: ElementTree.Element) -> str: if testcase.find("failure") is not None: testresult = "FAIL" elif testcase.find("error") is not None: testresult = "ERROR" else: testresult = "PASS" return testresult # Main routine if __name__ == "__main__": parser = argparse.ArgumentParser( Loading Loading @@ -116,26 +148,15 @@ if __name__ == "__main__": testcases = [tc for tc in testcases if tc.find(".//skipped") is not None] for testcase in testcases: if testcase.get("file") is None: fulltestname = ( testcase.get("classname").replace(".", "/") + ".py::" + testcase.get("name") filename = testcase.get( "file", testcase.get("classname").replace(".", "/") + ".py" ) else: fulltestname = testcase.get("file") + "::" + testcase.get("name") fulltestname = filename + "::" + testcase.get("name") properties_found = { p.get("name"): p.get("value") for p in testcase.findall(".//property") } if testcase.find("failure") is not None: testresult = "FAIL" elif testcase.find("error") is not None: testresult = "ERROR" else: testresult = "PASS" # Extract number of splits, if any splits = [p.split("_")[-1] for p in properties_found if "split" in p] splits = list(dict.fromkeys(splits)) # Remove duplicates, keeping order Loading @@ -152,21 +173,11 @@ if __name__ == "__main__": # Identify format and category (mode of operation) # For the format, favor the earliest match in the test case name fmt = min( [ (f, re.search(FORMATS[f], fulltestname, re.IGNORECASE).end()) for f in FORMATS if re.search(FORMATS[f], fulltestname, re.IGNORECASE) ], key=lambda x: x[1], )[0] fmt = get_format_from_fulltestname(fulltestname) # Note that only one category is selected, even though several may match, e.g. bitrate switching + JBM. Here the last match is picked. cat = [ c for c in CATEGORIES if re.search(CATEGORIES[c], fulltestname, re.IGNORECASE) ][-1] cat = get_category_from_fulltestname(fulltestname) testresult = get_testresult(testcase) # For ERROR cases, both a FAIL and an ERROR result is generated. # Here, a FAIL would be overwritten with an ERROR result since it has the same name. Loading