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 commit65b8a2be68
) (cherry picked from commit94e2651cf6
)
This commit is contained in:
parent
b94fdddc7c
commit
5230b8d30e
@ -84,9 +84,11 @@ def in_tempdir(prefix='tmp'):
|
||||
oldcwd = os.getcwd()
|
||||
tmpdir = tempfile.mkdtemp(prefix=prefix)
|
||||
os.chdir(tmpdir)
|
||||
yield
|
||||
os.chdir(oldcwd)
|
||||
shutil.rmtree(tmpdir)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
os.chdir(oldcwd)
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
def makeFakeRPM(repo_dir, name, epoch, version, release, files=None):
|
||||
"""Make a fake rpm file in repo_dir"""
|
||||
|
@ -1544,9 +1544,11 @@ def in_tempdir(prefix='tmp'):
|
||||
oldcwd = os.getcwd()
|
||||
tmpdir = tempfile.mkdtemp(prefix=prefix)
|
||||
os.chdir(tmpdir)
|
||||
yield
|
||||
os.chdir(oldcwd)
|
||||
shutil.rmtree(tmpdir)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
os.chdir(oldcwd)
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
def makeFakeRPM(repo_dir, name, epoch, version, release):
|
||||
"""Make a fake rpm file in repo_dir"""
|
||||
|
Loading…
Reference in New Issue
Block a user