diff --git a/src/extensions/score_source_code_linker/tests/test_xml_parser.py b/src/extensions/score_source_code_linker/tests/test_xml_parser.py index 3a2e110c..1d4615f1 100644 --- a/src/extensions/score_source_code_linker/tests/test_xml_parser.py +++ b/src/extensions/score_source_code_linker/tests/test_xml_parser.py @@ -203,7 +203,7 @@ def test_find_xml_files_test_reports( dir1: Path dir2: Path root, dir1, dir2, dir3, dir4 = tmp_xml_dirs(test_folder="tests-report") - found = xml_parser.find_xml_files(dir=root) + found = xml_parser.find_xml_files(search_path=root) assert found is not None expected: set[Path] = { root / dir1 / "test.xml", diff --git a/src/extensions/score_source_code_linker/xml_parser.py b/src/extensions/score_source_code_linker/xml_parser.py index cfa41f7f..9c741d9f 100644 --- a/src/extensions/score_source_code_linker/xml_parser.py +++ b/src/extensions/score_source_code_linker/xml_parser.py @@ -246,7 +246,7 @@ def read_test_xml_file(file: Path) -> tuple[list[DataOfTestCase], list[str], lis return test_case_needs, non_prop_tests, missing_prop_tests -def find_xml_files(dir: Path) -> list[Path]: +def find_xml_files(search_path: Path) -> list[Path]: """ Recursively search all test.xml files inside 'bazel-testlogs' @@ -260,13 +260,7 @@ def find_xml_files(dir: Path) -> list[Path]: """ test_file_name = "test.xml" - - xml_paths: list[Path] = [] - for root, _, files in os.walk(dir): - if test_file_name in files: - xml_paths.append(Path(os.path.join(root, test_file_name))) - - return xml_paths + return [x for x in search_path.rglob(test_file_name)] def find_test_folder(base_path: Path | None = None) -> Path | None: