Skip to content

Commit 8ba0bac

Browse files
Fixing of finding logic for XML paths (#454)
1 parent 6da857c commit 8ba0bac

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

src/extensions/score_source_code_linker/tests/test_xml_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def test_find_xml_files_test_reports(
203203
dir1: Path
204204
dir2: Path
205205
root, dir1, dir2, dir3, dir4 = tmp_xml_dirs(test_folder="tests-report")
206-
found = xml_parser.find_xml_files(dir=root)
206+
found = xml_parser.find_xml_files(search_path=root)
207207
assert found is not None
208208
expected: set[Path] = {
209209
root / dir1 / "test.xml",

src/extensions/score_source_code_linker/xml_parser.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def read_test_xml_file(file: Path) -> tuple[list[DataOfTestCase], list[str], lis
246246
return test_case_needs, non_prop_tests, missing_prop_tests
247247

248248

249-
def find_xml_files(dir: Path) -> list[Path]:
249+
def find_xml_files(search_path: Path) -> list[Path]:
250250
"""
251251
Recursively search all test.xml files inside 'bazel-testlogs'
252252
@@ -260,13 +260,7 @@ def find_xml_files(dir: Path) -> list[Path]:
260260
"""
261261

262262
test_file_name = "test.xml"
263-
264-
xml_paths: list[Path] = []
265-
for root, _, files in os.walk(dir):
266-
if test_file_name in files:
267-
xml_paths.append(Path(os.path.join(root, test_file_name)))
268-
269-
return xml_paths
263+
return [x for x in search_path.rglob(test_file_name)]
270264

271265

272266
def find_test_folder(base_path: Path | None = None) -> Path | None:

0 commit comments

Comments
 (0)