Clean up the tested copy in one place
This commit is contained in:
@@ -110,11 +110,8 @@ def tests_in_copy(containers: Containers, tree: str, folder: pathlib.Path, git:
|
|||||||
copied = on_disk(f"copy {tree} to test it", lambda: shutil.copytree(tree, copy, symlinks=True))
|
copied = on_disk(f"copy {tree} to test it", lambda: shutil.copytree(tree, copy, symlinks=True))
|
||||||
if isinstance(copied, Failure):
|
if isinstance(copied, Failure):
|
||||||
return copied
|
return copied
|
||||||
if failure := committed(git, str(copy)):
|
|
||||||
shutil.rmtree(copy, ignore_errors=True)
|
|
||||||
return failure
|
|
||||||
try:
|
try:
|
||||||
return ran_tests(containers, str(copy))
|
return committed(git, str(copy)) or ran_tests(containers, str(copy))
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(copy, ignore_errors=True)
|
shutil.rmtree(copy, ignore_errors=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user