From aa40889ea26d83025f7be759d6212f2bcc8e38f1 Mon Sep 17 00:00:00 2001 From: Arthur Zucker Date: Thu, 19 Dec 2024 17:34:21 +0100 Subject: [PATCH 1/6] [test-all] --- utils/tests_fetcher.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index 906e85e1de61a5..32164ff834f7bb 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -998,6 +998,7 @@ def infer_tests_to_run( output_file: str, diff_with_last_commit: bool = False, filter_models: bool = False, + test_all: bool = False ): """ The main function called by the test fetcher. Determines the tests to run from the diff. @@ -1018,7 +1019,10 @@ 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 tests. """ - modified_files = get_modified_python_files(diff_with_last_commit=diff_with_last_commit) + if not test_all: + modified_files = get_modified_python_files(diff_with_last_commit=diff_with_last_commit) + else: + modified_files = PATH_TO_TESTS.glob("*") print(f"\n### MODIFIED FILES ###\n{_print_list(modified_files)}") # Create the map that will give us all impacted modules. @@ -1230,5 +1234,6 @@ def create_test_list_from_filter(full_test_list, out_path): args.output_file, diff_with_last_commit=diff_with_last_commit, filter_models=False, + test_all=args.fetch_all ) filter_tests(args.output_file, ["repo_utils"]) From 4b2e80fe0bc10f04a1c6927130f4d3a73af9257a Mon Sep 17 00:00:00 2001 From: Arthur Zucker Date: Fri, 20 Dec 2024 14:49:42 +0100 Subject: [PATCH 2/6] style --- utils/tests_fetcher.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index 32164ff834f7bb..22b82388f98f26 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -995,10 +995,7 @@ def _print_list(l) -> str: def infer_tests_to_run( - output_file: str, - diff_with_last_commit: bool = False, - filter_models: bool = False, - test_all: bool = False + output_file: str, diff_with_last_commit: bool = False, filter_models: bool = False, test_all: bool = False ): """ The main function called by the test fetcher. Determines the tests to run from the diff. @@ -1023,6 +1020,7 @@ def infer_tests_to_run( modified_files = get_modified_python_files(diff_with_last_commit=diff_with_last_commit) else: modified_files = PATH_TO_TESTS.glob("*") + print("\n### test_all is TRUE, FETCHING ALL FILES###\n") print(f"\n### MODIFIED FILES ###\n{_print_list(modified_files)}") # Create the map that will give us all impacted modules. @@ -1231,9 +1229,6 @@ def create_test_list_from_filter(full_test_list, out_path): diff_with_last_commit = True infer_tests_to_run( - args.output_file, - diff_with_last_commit=diff_with_last_commit, - filter_models=False, - test_all=args.fetch_all + args.output_file, diff_with_last_commit=diff_with_last_commit, filter_models=False, test_all=args.fetch_all ) filter_tests(args.output_file, ["repo_utils"]) From 70e27daad0a2d17aaf21397f6a7ee8a03a8984cf Mon Sep 17 00:00:00 2001 From: Arthur Zucker Date: Fri, 20 Dec 2024 14:51:35 +0100 Subject: [PATCH 3/6] [test-all] From f06d0c2161ddd3b6dc3a3c1f2377cc5110c00a90 Mon Sep 17 00:00:00 2001 From: Arthur Zucker Date: Fri, 20 Dec 2024 14:53:29 +0100 Subject: [PATCH 4/6] [test_all] --- utils/tests_fetcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index 22b82388f98f26..5194e91721bcfe 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -1229,6 +1229,6 @@ def create_test_list_from_filter(full_test_list, out_path): diff_with_last_commit = True infer_tests_to_run( - args.output_file, diff_with_last_commit=diff_with_last_commit, filter_models=False, test_all=args.fetch_all + args.output_file, diff_with_last_commit=diff_with_last_commit, filter_models=False, test_all=commit_flags["test_all"] ) filter_tests(args.output_file, ["repo_utils"]) From bb8e1abca3a94fa7896592669b8bbb2468a9f93d Mon Sep 17 00:00:00 2001 From: Arthur Zucker Date: Fri, 20 Dec 2024 14:58:27 +0100 Subject: [PATCH 5/6] [test_all] --- utils/tests_fetcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index 5194e91721bcfe..48cd50c3e6dbe8 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -1019,7 +1019,7 @@ def infer_tests_to_run( if not test_all: modified_files = get_modified_python_files(diff_with_last_commit=diff_with_last_commit) else: - modified_files = PATH_TO_TESTS.glob("*") + 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)}") From bbc2fd2f9184dd8b0c61412445c5ee64c5c2f4e6 Mon Sep 17 00:00:00 2001 From: Arthur Zucker Date: Fri, 20 Dec 2024 15:01:55 +0100 Subject: [PATCH 6/6] style --- utils/tests_fetcher.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index 48cd50c3e6dbe8..c641ccb21e2984 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -1019,7 +1019,7 @@ def infer_tests_to_run( if not test_all: 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)] + 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)}") @@ -1229,6 +1229,9 @@ def create_test_list_from_filter(full_test_list, out_path): diff_with_last_commit = True infer_tests_to_run( - args.output_file, diff_with_last_commit=diff_with_last_commit, filter_models=False, test_all=commit_flags["test_all"] + args.output_file, + diff_with_last_commit=diff_with_last_commit, + filter_models=False, + test_all=commit_flags["test_all"], ) filter_tests(args.output_file, ["repo_utils"])