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 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]