From 5ef3836d152c3fc88d579f0b7c2de1f590d2555c Mon Sep 17 00:00:00 2001 From: Joao Gante Date: Fri, 30 Aug 2024 19:20:12 +0000 Subject: [PATCH 1/6] missing return --- utils/tests_fetcher.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index e926a96d9604..ac389c62ad11 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -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) From 1c39d963b020d8ef40379cfe4ea4f4668b16a6e0 Mon Sep 17 00:00:00 2001 From: Joao Gante Date: Fri, 30 Aug 2024 19:54:30 +0000 Subject: [PATCH 2/6] skip files without contents --- .circleci/create_circleci_config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.circleci/create_circleci_config.py b/.circleci/create_circleci_config.py index 469d32fd84dc..f694ea455c34 100644 --- a/.circleci/create_circleci_config.py +++ b/.circleci/create_circleci_config.py @@ -346,7 +346,13 @@ def create_circleci_config(folder=None): if folder is None: folder = os.getcwd() os.environ["test_preparation_dir"] = folder - jobs = [k for k in ALL_TESTS if os.path.isfile(os.path.join("test_preparation" , f"{k.job_name}_test_list.txt") )] + + def has_file_with_contents(file_path): + return os.path.isfile(file_path) and os.path.getsize(file_path) > 0 + + jobs = [ + k for k in ALL_TESTS if has_file_with_contents(os.path.join("test_preparation", f"{k.job_name}_test_list.txt")) + ] print("The following jobs will be run ", jobs) if len(jobs) == 0: From 50e95290e8808c9fb2dc68605334fdbb496b036b Mon Sep 17 00:00:00 2001 From: Joao Gante Date: Fri, 30 Aug 2024 20:05:38 +0000 Subject: [PATCH 3/6] test 2 --- .circleci/create_circleci_config.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.circleci/create_circleci_config.py b/.circleci/create_circleci_config.py index f694ea455c34..469d32fd84dc 100644 --- a/.circleci/create_circleci_config.py +++ b/.circleci/create_circleci_config.py @@ -346,13 +346,7 @@ def create_circleci_config(folder=None): if folder is None: folder = os.getcwd() os.environ["test_preparation_dir"] = folder - - def has_file_with_contents(file_path): - return os.path.isfile(file_path) and os.path.getsize(file_path) > 0 - - jobs = [ - k for k in ALL_TESTS if has_file_with_contents(os.path.join("test_preparation", f"{k.job_name}_test_list.txt")) - ] + jobs = [k for k in ALL_TESTS if os.path.isfile(os.path.join("test_preparation" , f"{k.job_name}_test_list.txt") )] print("The following jobs will be run ", jobs) if len(jobs) == 0: From dee1209f74d4154f24267108c0c722d570bf24a0 Mon Sep 17 00:00:00 2001 From: Joao Gante Date: Fri, 30 Aug 2024 20:07:17 +0000 Subject: [PATCH 4/6] dbg --- utils/tests_fetcher.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index ac389c62ad11..56cb03b0a931 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -1153,6 +1153,7 @@ def parse_commit_message(commit_message: str) -> Dict[str, bool]: def create_test_list_from_filter(full_test_list, out_path): all_test_files = "\n".join(full_test_list) + breakpoint() for job_name, _filter in JOB_TO_TEST_FILE.items(): file_name = os.path.join(out_path, f"{job_name}_test_list.txt") if job_name == "tests_hub": From 2633cf267b81eab0cb33b7d909d171a3639cbddd Mon Sep 17 00:00:00 2001 From: Joao Gante Date: Fri, 30 Aug 2024 20:07:54 +0000 Subject: [PATCH 5/6] dbg --- utils/tests_fetcher.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index 56cb03b0a931..cdaff4286fda 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -1153,7 +1153,6 @@ def parse_commit_message(commit_message: str) -> Dict[str, bool]: def create_test_list_from_filter(full_test_list, out_path): all_test_files = "\n".join(full_test_list) - breakpoint() for job_name, _filter in JOB_TO_TEST_FILE.items(): file_name = os.path.join(out_path, f"{job_name}_test_list.txt") if job_name == "tests_hub": @@ -1161,8 +1160,8 @@ 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)) + # with open(file_name, "w") as f: + # f.write("\n".join(files_to_test)) if __name__ == "__main__": From fa04f157b36c5f4128c155ff508787080d06c6eb Mon Sep 17 00:00:00 2001 From: Joao Gante Date: Fri, 30 Aug 2024 20:09:30 +0000 Subject: [PATCH 6/6] how about this? --- utils/tests_fetcher.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index cdaff4286fda..8ccd738c1df6 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -1160,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__":