Clean up the tested copy in one place

This commit is contained in:
2026-12-03 13:02:01 +01:00
parent c1412f598c
commit 459705c88a
+1 -4
View File
@@ -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))
if isinstance(copied, Failure):
return copied
if failure := committed(git, str(copy)):
shutil.rmtree(copy, ignore_errors=True)
return failure
try:
return ran_tests(containers, str(copy))
return committed(git, str(copy)) or ran_tests(containers, str(copy))
finally:
shutil.rmtree(copy, ignore_errors=True)