From f2ab182dca2a9aa4a053a1903bd4b46b90ff9f78 Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Thu, 20 Feb 2025 13:32:02 +0100 Subject: [PATCH] Ignore conversion files in test fetcher (#36251) fix Co-authored-by: ydshieh --- utils/tests_fetcher.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index 3543b18f9c..4074904426 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -730,6 +730,8 @@ def get_module_dependencies(module_fname: str, cache: Dict[str, List[str]] = Non while len(imported_modules) > 0: new_modules = [] for module, imports in imported_modules: + if "models" in module.split("/") and module.split("/")[-1].startswith("convert_"): + continue # If we end up in an __init__ we are often not actually importing from this init (except in the case where # the object is fully defined in the __init__) if module.endswith("__init__.py"): @@ -780,7 +782,9 @@ def create_reverse_dependency_tree() -> List[Tuple[str, str]]: Create a list of all edges (a, b) which mean that modifying a impacts b with a going over all module and test files. """ cache = {} - all_modules = list(PATH_TO_TRANFORMERS.glob("**/*.py")) + list(PATH_TO_TESTS.glob("**/*.py")) + all_modules = list(PATH_TO_TRANFORMERS.glob("**/*.py")) + all_modules = [x for x in all_modules if not ("models" in x.parts and x.parts[-1].startswith("convert_"))] + all_modules += list(PATH_TO_TESTS.glob("**/*.py")) all_modules = [str(mod.relative_to(PATH_TO_REPO)) for mod in all_modules] edges = [(dep, mod) for mod in all_modules for dep in get_module_dependencies(mod, cache=cache)] @@ -898,7 +902,9 @@ def create_reverse_dependency_map() -> Dict[str, List[str]]: # Start from the example deps init. example_deps, examples = init_test_examples_dependencies() # Add all modules and all tests to all examples - all_modules = list(PATH_TO_TRANFORMERS.glob("**/*.py")) + list(PATH_TO_TESTS.glob("**/*.py")) + examples + all_modules = list(PATH_TO_TRANFORMERS.glob("**/*.py")) + all_modules = [x for x in all_modules if not ("models" in x.parts and x.parts[-1].startswith("convert_"))] + all_modules += list(PATH_TO_TESTS.glob("**/*.py")) + examples all_modules = [str(mod.relative_to(PATH_TO_REPO)) for mod in all_modules] # Compute the direct dependencies of all modules. direct_deps = {m: get_module_dependencies(m, cache=cache) for m in all_modules}