From f1851564d00e90bd57f4e5e922ab0199e7c0ba93 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 20:11:21 +0000 Subject: [PATCH] tests: stop post-push housekeeping racing test_pickup_fence's tearDown Navigation run 39660134212 failed in its -O pass. tearDown's rmtree met "OSError: [Errno 39] Directory not empty: 'pack'" in the bare remote's objects/pack, because receive-pack had started automatic housekeeping in the background after the test's last push. This turns off gc.auto, maintenance.auto and receive.autogc in each repository the fixture creates. The settings go in each repository's own config, because a local receive-pack does not see the pushing side's -c or GIT_CONFIG_* values. The assertions are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01V3DF6ms7UTpj27UqDG4u5h --- tests/test_pickup_fence.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_pickup_fence.py b/tests/test_pickup_fence.py index 39d075410..d536490f4 100644 --- a/tests/test_pickup_fence.py +++ b/tests/test_pickup_fence.py @@ -34,6 +34,15 @@ def git(*args, cwd, check=True): return r +def no_housekeeping(repo): + """Turn off automatic gc and maintenance in ``repo``. They can run detached after a push, + fetch or commit and still be writing into ``objects/pack`` while tearDown removes the tree. + The setting goes in each repository's own config, because a local ``receive-pack`` does not + see the pushing side's ``-c`` or ``GIT_CONFIG_*`` settings.""" + for key, value in (('gc.auto', '0'), ('maintenance.auto', 'false'), ('receive.autogc', 'false')): + git('config', key, value, cwd=repo) + + class PickupFenceTest(unittest.TestCase): """Worker A holds a stale view of ``work``; worker B has pushed a newer commit.""" @@ -42,8 +51,10 @@ def setUp(self): root = self.tmp.name self.remote = os.path.join(root, 'remote.git') git('init', '--bare', '-q', '-b', 'main', self.remote, cwd=root) + no_housekeeping(self.remote) seed = os.path.join(root, 'seed') git('clone', '-q', self.remote, seed, cwd=root) + no_housekeeping(seed) with open(os.path.join(seed, 'f.txt'), 'w') as f: f.write('base\n') git('add', 'f.txt', cwd=seed) @@ -53,6 +64,7 @@ def setUp(self): self.b = os.path.join(root, 'b') for d in (self.a, self.b): git('clone', '-q', '-b', 'work', self.remote, d, cwd=root) + no_housekeeping(d) self.old_head = git('rev-parse', 'HEAD', cwd=self.a).stdout.strip() # B advances the branch; A does not fetch. with open(os.path.join(self.b, 'f.txt'), 'a') as f: