change the HOME for git commands to avoid using the user git configuration

This commit is contained in:
Bernat Gabor 2017-10-27 11:01:52 +01:00
parent 9e193f7fc8
commit 5b472b30eb
No known key found for this signature in database
GPG key ID: 25F70E3BB8B17899
2 changed files with 10 additions and 5 deletions

View file

@ -39,6 +39,11 @@ def tempdir_factory(tmpdir):
yield TmpdirFactory()
@pytest.fixture()
def setup_git(monkeypatch, tmpdir):
# we should not use user configuration
monkeypatch.setenv('HOME', tmpdir)
@pytest.yield_fixture
def in_tmpdir(tempdir_factory):
path = tempdir_factory.get()
@ -67,7 +72,7 @@ def _make_conflict():
@pytest.yield_fixture
def in_merge_conflict(tempdir_factory):
def in_merge_conflict(tempdir_factory, setup_git):
path = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
with cwd(path):
open('dummy', 'a').close()
@ -82,7 +87,7 @@ def in_merge_conflict(tempdir_factory):
@pytest.yield_fixture
def in_conflicting_submodule(tempdir_factory):
def in_conflicting_submodule(tempdir_factory, setup_git):
git_dir_1 = git_dir(tempdir_factory)
git_dir_2 = git_dir(tempdir_factory)
with cwd(git_dir_2):