Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions test/fixtures/git_config_defaults
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions test/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
Loading