From 6fd9ed80db0346aae8929cff33d7991292116e20 Mon Sep 17 00:00:00 2001 From: Waozi Date: Fri, 23 Oct 2026 04:36:10 -0300 Subject: [PATCH] Keep git maintenance out of the temporary repositories tests remove --- tests/file_size_test.py | 3 +++ tests/phone_check_gate_test.py | 3 +++ tests/release_test.py | 11 +++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/file_size_test.py b/tests/file_size_test.py index 9e0ef96e3..ce42cddc7 100644 --- a/tests/file_size_test.py +++ b/tests/file_size_test.py @@ -19,6 +19,9 @@ class FileSizeTest(unittest.TestCase): self.addCleanup(temporary.cleanup) self.root = Path(temporary.name) self.git("init", "-q") + # Commits otherwise start git maintenance in the background, which can + # still be writing to .git while the temporary directory is removed. + self.git("config", "maintenance.auto", "false") self.git("config", "user.email", "test@example.invalid") self.git("config", "user.name", "Test") self.stage({"README.md": b"small\n", guard.ALLOWLIST: b"# shipped\nassets/*.mp4\n"}) diff --git a/tests/phone_check_gate_test.py b/tests/phone_check_gate_test.py index f5c1d0fef..f348dd389 100644 --- a/tests/phone_check_gate_test.py +++ b/tests/phone_check_gate_test.py @@ -32,6 +32,9 @@ class PhoneCheckGateTest(unittest.TestCase): self.addCleanup(temporary.cleanup) self.root = Path(temporary.name) self.git("init", "-q") + # Commits otherwise start git maintenance in the background, which can + # still be writing to .git while the temporary directory is removed. + self.git("config", "maintenance.auto", "false") self.git("config", "user.email", "test@example.invalid") self.git("config", "user.name", "Test") self.commit({"src/main.zi": "one\n", "src/core/version.zi": "VersionString :: \"2.9.9\"\n", diff --git a/tests/release_test.py b/tests/release_test.py index 26d674404..6eb99216f 100644 --- a/tests/release_test.py +++ b/tests/release_test.py @@ -18,6 +18,10 @@ release = importlib.util.module_from_spec(spec) spec.loader.exec_module(release) +REPOSITORY_CONFIG = (("maintenance.auto", "false"), ("user.email", "test@example.invalid"), + ("user.name", "Test")) + + def git(root, *argv): return subprocess.run(["git", "-C", str(root), *argv], check=True, capture_output=True, text=True).stdout @@ -32,7 +36,10 @@ class ReleaseTest(unittest.TestCase): self.root = base / "inbe" git(base, "init", "-q", "--bare", "-b", "master", str(self.origin)) git(base, "init", "-q", "-b", "master", str(self.root)) - for key, value in (("user.email", "test@example.invalid"), ("user.name", "Test")): + # Commits and pushes otherwise start git maintenance in the background, + # which can still be writing while the temporary directory is removed. + git(self.origin, "config", "maintenance.auto", "false") + for key, value in REPOSITORY_CONFIG: git(self.root, "config", key, value) git(self.root, "remote", "add", "origin", str(self.origin)) self.commit({".gitignore": "/build/\n", "src/main.zi": "one\n", "src/core/version.zi": "2.9.9\n", "docs/notes.md": "notes\n"}, @@ -151,7 +158,7 @@ class ReleaseTest(unittest.TestCase): def test_package_overrides_must_sit_clean_on_the_lock(self): package = self.root.parent / "kryon" git(self.root.parent, "init", "-q", str(package)) - for key, value in (("user.email", "test@example.invalid"), ("user.name", "Test")): + for key, value in REPOSITORY_CONFIG: git(package, "config", key, value) (package / "ui.zi").write_text("one\n") git(package, "add", "ui.zi")