From d5d86e7663c0411828a3f0d77abf2abe0549566d Mon Sep 17 00:00:00 2001 From: "E-Love (Eric Loveland)" Date: Tue, 12 May 2026 16:53:01 -0400 Subject: [PATCH 1/2] fix(tests): consistent config Since there are many ways to configure git, use a standard configuration file, so tests always run with consistent settings --- test/conftest.py | 10 ++++++++++ test/fixtures/git_config_defaults | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/conftest.py create mode 100644 test/fixtures/git_config_defaults diff --git a/test/conftest.py b/test/conftest.py new file mode 100644 index 000000000..84f216a16 --- /dev/null +++ b/test/conftest.py @@ -0,0 +1,10 @@ +import os +from test.lib import fixture_path + +# ensure all tests run with consistent config since some settings break tests +# we could also use pytest-env for this but it's less consistent across OSs + +os.environ["GIT_CONFIG_NOSYSTEM"] = "true" +os.environ["GIT_CONFIG_GLOBAL"] = fixture_path("git_config_defaults") +os.environ.pop("GIT_CONFIG_COUNT", None) +os.environ.pop("GIT_CONFIG_SYSTEM", None) diff --git a/test/fixtures/git_config_defaults b/test/fixtures/git_config_defaults new file mode 100644 index 000000000..30d0eb5bd --- /dev/null +++ b/test/fixtures/git_config_defaults @@ -0,0 +1,8 @@ +# defaulted via env var in conftest.py to avoid user-specific configs breaking tests + +[init] + defaultBranch = master + +[user] + name = Sebastian Thiel + email = byronimo@gmail.com From 38e0f991467a8fb9f2c17f530b8da41fc34ad5c9 Mon Sep 17 00:00:00 2001 From: "E-Love (Eric Loveland)" Date: Tue, 12 May 2026 16:59:57 -0400 Subject: [PATCH 2/2] fix(test_docs): deterministic remote test The remote test relied on a full repo clone that included all branches, which isn't guaranteed, especially in CI environments and when using repo forks. Use the cloned repo instead, since it will still test the desired functionality but will always have the necessary upstream branch. --- test/test_docs.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test_docs.py b/test/test_docs.py index cc0bbf26a..ca8059eed 100644 --- a/test/test_docs.py +++ b/test/test_docs.py @@ -83,8 +83,7 @@ def test_init_repo_object(self, rw_dir): self.assertEqual(repo.tags["0.3.5"], repo.tag("refs/tags/0.3.5")) # You can access tags in various ways too. self.assertEqual(repo.refs.master, repo.heads["master"]) # .refs provides all refs, i.e. heads... - if "TRAVIS" not in os.environ: - self.assertEqual(repo.refs["origin/master"], repo.remotes.origin.refs.master) # ... remotes ... + self.assertEqual(cloned_repo.refs["origin/master"], cloned_repo.remotes.origin.refs.master) # ... remotes ... self.assertEqual(repo.refs["0.3.5"], repo.tags["0.3.5"]) # ... and tags. # ![8-test_init_repo_object]