From d78d1f1a2feb7c5e5c31e3759c7e370d078a0473 Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Wed, 21 Oct 2026 09:08:27 +0800 Subject: [PATCH] fix: isolate sitemap lastmod test from inherited GIT_* variables The test ran git init/add/commit with the inherited environment, so under a git hook or `git rebase --exec` (which set GIT_DIR) it committed fixture commits into the real repository and flipped its core.bare to true. Co-Authored-By: Claude --- website/tests/test_build.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/website/tests/test_build.py b/website/tests/test_build.py index 6b32f756..7bba67be 100644 --- a/website/tests/test_build.py +++ b/website/tests/test_build.py @@ -229,7 +229,10 @@ class TestBuild: assert all(loc.startswith("https://awesome-python.com/") for loc in locs) assert all("?" not in loc for loc in locs) - def test_sitemap_lastmod_follows_git_history_of_each_page(self, tmp_path): + def test_sitemap_lastmod_follows_git_history_of_each_page(self, tmp_path, monkeypatch): + # Inside a git hook or `git rebase --exec`, inherited GIT_DIR points every git call below at the real repo + for key in [k for k in os.environ if k.startswith("GIT_")]: + monkeypatch.delenv(key) readme = textwrap.dedent("""\ # Awesome Python