Fix filtering in test fetcher utils (#13766)

This commit is contained in:
Sylvain Gugger
2021-09-27 15:26:54 -04:00
committed by GitHub
parent 11c69b8045
commit 5e3b4a70d3

View File

@@ -442,8 +442,10 @@ def infer_tests_to_run(output_file, diff_with_last_commit=False, filters=None):
# Make sure we did not end up with a test file that was removed
test_files_to_run = [f for f in test_files_to_run if os.path.isfile(f) or os.path.isdir(f)]
if filters is not None:
filtered_files = []
for filter in filters:
test_files_to_run = [f for f in test_files_to_run if f.startswith(filter)]
filtered_files.extend([f for f in test_files_to_run if f.startswith(filter)])
test_files_to_run = filtered_files
print(f"\n### TEST TO RUN ###\n{_print_list(test_files_to_run)}")
if len(test_files_to_run) > 0: