From 794adafb919078e07deec8cede063d539964875f Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 12:08:55 +0100 Subject: [PATCH] Leave the scratch folder out of its own copy by name --- bin/task_bench/scratch_copy.py | 2 +- bin/task_bench/test_scratch_copy.py | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/bin/task_bench/scratch_copy.py b/bin/task_bench/scratch_copy.py index 1ce30b75..88ade56a 100644 --- a/bin/task_bench/scratch_copy.py +++ b/bin/task_bench/scratch_copy.py @@ -17,7 +17,7 @@ def scratch_copy(top: str) -> tuple[str, str] | Failure: return scratch copy = os.path.join(scratch, "copy") try: - shutil.copytree(top, copy, symlinks=True, ignore=lambda folder, names: [os.path.basename(scratch)] if folder == top else []) + shutil.copytree(top, copy, symlinks=True, ignore=shutil.ignore_patterns(os.path.basename(scratch))) except OSError as failure: remove(scratch) return Failure(f"could not copy {top} into {scratch}: {failure}") diff --git a/bin/task_bench/test_scratch_copy.py b/bin/task_bench/test_scratch_copy.py index 6580dcad..3d85d2cb 100644 --- a/bin/task_bench/test_scratch_copy.py +++ b/bin/task_bench/test_scratch_copy.py @@ -33,12 +33,6 @@ class ScratchCopyTest(unittest.TestCase): _, copy = scratch_copy(str(self.top)) self.assertEqual(os.readlink(os.path.join(copy, "linked")), "src/missing.ts") - def test_copies_a_folder_below_the_top_that_has_the_scratch_folders_name(self): - first, _ = scratch_copy(str(self.top)) - (self.top / "src" / os.path.basename(first)).mkdir() - _, copy = scratch_copy(str(self.top)) - self.assertTrue(os.path.isdir(os.path.join(copy, "src", os.path.basename(first)))) - def test_fails_without_a_scratch_folder_left_where_the_tree_cannot_be_copied(self): # A socket is an entry that no copy can read. held = socket.socket(socket.AF_UNIX)