Update test fetcher when we want to test all (#35364)
* [test-all] * style * [test-all] * [test_all] * [test_all] * style
This commit is contained in:
@@ -995,9 +995,7 @@ def _print_list(l) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def infer_tests_to_run(
|
def infer_tests_to_run(
|
||||||
output_file: str,
|
output_file: str, diff_with_last_commit: bool = False, filter_models: bool = False, test_all: bool = False
|
||||||
diff_with_last_commit: bool = False,
|
|
||||||
filter_models: bool = False,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
The main function called by the test fetcher. Determines the tests to run from the diff.
|
The main function called by the test fetcher. Determines the tests to run from the diff.
|
||||||
@@ -1018,7 +1016,11 @@ def infer_tests_to_run(
|
|||||||
Whether or not to filter the tests to core models only, when a file modified results in a lot of model
|
Whether or not to filter the tests to core models only, when a file modified results in a lot of model
|
||||||
tests.
|
tests.
|
||||||
"""
|
"""
|
||||||
|
if not test_all:
|
||||||
modified_files = get_modified_python_files(diff_with_last_commit=diff_with_last_commit)
|
modified_files = get_modified_python_files(diff_with_last_commit=diff_with_last_commit)
|
||||||
|
else:
|
||||||
|
modified_files = [str(k) for k in PATH_TO_TESTS.glob("*/*") if str(k).endswith(".py") and "test_" in str(k)]
|
||||||
|
print("\n### test_all is TRUE, FETCHING ALL FILES###\n")
|
||||||
print(f"\n### MODIFIED FILES ###\n{_print_list(modified_files)}")
|
print(f"\n### MODIFIED FILES ###\n{_print_list(modified_files)}")
|
||||||
|
|
||||||
# Create the map that will give us all impacted modules.
|
# Create the map that will give us all impacted modules.
|
||||||
@@ -1230,5 +1232,6 @@ if __name__ == "__main__":
|
|||||||
args.output_file,
|
args.output_file,
|
||||||
diff_with_last_commit=diff_with_last_commit,
|
diff_with_last_commit=diff_with_last_commit,
|
||||||
filter_models=False,
|
filter_models=False,
|
||||||
|
test_all=commit_flags["test_all"],
|
||||||
)
|
)
|
||||||
filter_tests(args.output_file, ["repo_utils"])
|
filter_tests(args.output_file, ["repo_utils"])
|
||||||
|
|||||||
Reference in New Issue
Block a user