Skip to content

Commit

Permalink
Ignore conversion files in test fetcher (#36251)
Browse files Browse the repository at this point in the history
fix

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
  • Loading branch information
ydshieh and ydshieh authored Feb 20, 2025
1 parent e8531a0 commit f2ab182
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions utils/tests_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down Expand Up @@ -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)]

Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit f2ab182

Please sign in to comment.