Skip to content

Commit 58533a7

Browse files
committed
Refresh from importlib_metadata@cpython
1 parent a277d85 commit 58533a7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/test/test_importlib/fixtures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@
2424
@contextlib.contextmanager
2525
def tempdir():
2626
tmpdir = tempfile.mkdtemp()
27-
sys.path[:0] = [tmpdir]
2827
try:
2928
yield pathlib.Path(tmpdir)
3029
finally:
31-
sys.path.remove(tmpdir)
3230
shutil.rmtree(tmpdir)
3331

3432

@@ -55,7 +53,10 @@ class SiteDir:
5553
def site_dir():
5654
with tempdir() as tmp:
5755
sys.path[:0] = [str(tmp)]
58-
yield tmp
56+
try:
57+
yield tmp
58+
finally:
59+
sys.path.remove(str(tmp))
5960

6061
def setUp(self):
6162
self.fixtures = ExitStack()
@@ -193,4 +194,3 @@ def build_files(file_defs, prefix=pathlib.Path()):
193194
def DALS(str):
194195
"Dedent and left-strip"
195196
return textwrap.dedent(str).lstrip()
196-

0 commit comments

Comments
 (0)