@@ -417,26 +417,30 @@ def infer_tests_to_run(output_file, diff_with_last_commit=False, filters=None):
417
417
print (f"\n ### IMPACTED FILES ###\n { _print_list (impacted_files )} " )
418
418
419
419
# Grab the corresponding test files:
420
- test_files_to_run = []
421
- for f in impacted_files :
422
- # Modified test files are always added
423
- if f .startswith ("tests/" ):
424
- test_files_to_run .append (f )
425
- else :
426
- new_tests = module_to_test_file (f )
427
- if new_tests is not None :
428
- if isinstance (new_tests , str ):
429
- test_files_to_run .append (new_tests )
430
- else :
431
- test_files_to_run .extend (new_tests )
432
-
433
- # Remove duplicates
434
- test_files_to_run = sorted (list (set (test_files_to_run )))
435
- # Make sure we did not end up with a test file that was removed
436
- test_files_to_run = [f for f in test_files_to_run if os .path .isfile (f ) or os .path .isdir (f )]
437
- if filters is not None :
438
- for filter in filters :
439
- test_files_to_run = [f for f in test_files_to_run if f .startswith (filter )]
420
+ if "setup.py" in impacted_files :
421
+ test_files_to_run = ["tests" ]
422
+ else :
423
+ # Grab the corresponding test files:
424
+ test_files_to_run = []
425
+ for f in impacted_files :
426
+ # Modified test files are always added
427
+ if f .startswith ("tests/" ):
428
+ test_files_to_run .append (f )
429
+ else :
430
+ new_tests = module_to_test_file (f )
431
+ if new_tests is not None :
432
+ if isinstance (new_tests , str ):
433
+ test_files_to_run .append (new_tests )
434
+ else :
435
+ test_files_to_run .extend (new_tests )
436
+
437
+ # Remove duplicates
438
+ test_files_to_run = sorted (list (set (test_files_to_run )))
439
+ # Make sure we did not end up with a test file that was removed
440
+ test_files_to_run = [f for f in test_files_to_run if os .path .isfile (f ) or os .path .isdir (f )]
441
+ if filters is not None :
442
+ for filter in filters :
443
+ test_files_to_run = [f for f in test_files_to_run if f .startswith (filter )]
440
444
441
445
print (f"\n ### TEST TO RUN ###\n { _print_list (test_files_to_run )} " )
442
446
if len (test_files_to_run ) > 0 :
0 commit comments