We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9f678a commit 1f74151Copy full SHA for 1f74151
cruft/_commands/utils/iohelper.py
@@ -20,9 +20,15 @@ def __enter__(self):
20
21
def cleanup(self, cnt=0):
22
if self._extended_path:
23
- name = str(Path(self.tmpdir.name) / self._directory)
24
- if name in sys.path:
25
- sys.path.remove(name)
+ dir_path = Path(self.tmpdir.name) / self._directory
+ dir_name = str(dir_path)
+ if dir_name in sys.path:
26
+ sys.path.remove(dir_name)
27
+ for name, mod in list(sys.modules.items()):
28
+ if getattr(mod, "__file__", None):
29
+ mod_path = Path(mod.__file__)
30
+ if dir_path < mod_path:
31
+ del sys.modules[name]
32
if cnt >= 5: # pragma: no cover
33
raise RuntimeError("Could not delete TemporaryDirectory!")
34
try:
0 commit comments