Skip to content

Commit

Permalink
Remove find_dependent_paths and depenent path cleanup (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
zero323 authored Oct 19, 2021
1 parent 277e9c6 commit 1ad40a9
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions pytest_mypy_plugins/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,6 @@ def remove_cache_files(self, fpath_no_suffix: Path) -> None:
):
parent_dir.rmdir()

def find_dependent_paths(self, path: Path) -> List[Path]:
py_module = ".".join(path.with_suffix("").parts)
dependants = []
for dirpath, _, filenames in os.walk(self.incremental_cache_dir):
for filename in filenames:
path = Path(dirpath) / filename
if f'"{py_module}"' in path.read_text():
dependants.append(path.with_suffix("").with_suffix(""))
return dependants

def typecheck_in_new_subprocess(
self, execution_path: Path, mypy_cmd_options: List[Any]
) -> Tuple[int, Tuple[str, str]]:
Expand Down Expand Up @@ -284,16 +274,12 @@ def runtest(self) -> None:

finally:
temp_dir.cleanup()
# remove created modules and all their dependants from cache
# remove created modules
if not self.disable_cache:
for file in self.files:
path = Path(file.path)
self.remove_cache_files(path.with_suffix(""))

dependants = self.find_dependent_paths(path)
for dependant in dependants:
self.remove_cache_files(dependant)

assert not os.path.exists(temp_dir.name)

def prepare_mypy_cmd_options(self, execution_path: Path) -> List[str]:
Expand Down

0 comments on commit 1ad40a9

Please sign in to comment.