Skip to content

Commit

Permalink
Test fetcher: missing return on filtered tests; don't write empty fil…
Browse files Browse the repository at this point in the history
…es (#33224)

* missing return

* skip files without contents

* test 2

* dbg

* dbg

* how about this?
  • Loading branch information
gante authored Aug 30, 2024
1 parent 51e6526 commit 746104b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utils/tests_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ def filter_tests(tests, module=""):
or "/".join(Path(t).parts[1:3]) in module
):
filtered_tests += [t]
return filtered_tests

return {
module: (filter_tests(tests, module=module) if has_many_models(tests) else tests)
Expand Down Expand Up @@ -1159,8 +1160,9 @@ def create_test_list_from_filter(full_test_list, out_path):
else:
files_to_test = list(re.findall(_filter, all_test_files))
print(job_name, file_name)
with open(file_name, "w") as f:
f.write("\n".join(files_to_test))
if len(files_to_test) > 0: # No tests -> no file with test list
with open(file_name, "w") as f:
f.write("\n".join(files_to_test))


if __name__ == "__main__":
Expand Down

0 comments on commit 746104b

Please sign in to comment.