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 a277d85 commit 58533a7Copy full SHA for 58533a7
Lib/test/test_importlib/fixtures.py
@@ -24,11 +24,9 @@
24
@contextlib.contextmanager
25
def tempdir():
26
tmpdir = tempfile.mkdtemp()
27
- sys.path[:0] = [tmpdir]
28
try:
29
yield pathlib.Path(tmpdir)
30
finally:
31
- sys.path.remove(tmpdir)
32
shutil.rmtree(tmpdir)
33
34
@@ -55,7 +53,10 @@ class SiteDir:
55
53
def site_dir():
56
54
with tempdir() as tmp:
57
sys.path[:0] = [str(tmp)]
58
- yield tmp
+ try:
+ yield tmp
+ finally:
59
+ sys.path.remove(str(tmp))
60
61
def setUp(self):
62
self.fixtures = ExitStack()
@@ -193,4 +194,3 @@ def build_files(file_defs, prefix=pathlib.Path()):
193
194
def DALS(str):
195
"Dedent and left-strip"
196
return textwrap.dedent(str).lstrip()
-
0 commit comments