tests: Cleanup on failure of in_tempdir
Otherwise other tests will also fail when they try to run from the wrong
directory.
(cherry picked from commit 65b8a2be68
)
This commit is contained in:
parent
eb4a8ac3b1
commit
94e2651cf6
@ -84,7 +84,9 @@ def in_tempdir(prefix='tmp'):
|
||||
oldcwd = os.getcwd()
|
||||
tmpdir = tempfile.mkdtemp(prefix=prefix)
|
||||
os.chdir(tmpdir)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
os.chdir(oldcwd)
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
|
@ -1559,7 +1559,9 @@ def in_tempdir(prefix='tmp'):
|
||||
oldcwd = os.getcwd()
|
||||
tmpdir = tempfile.mkdtemp(prefix=prefix)
|
||||
os.chdir(tmpdir)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
os.chdir(oldcwd)
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user