Skip to content

Commit aec1c55

Browse files
committed
Merge pull request #222 from pre-commit/care_less_about_user_installs_in_tests_221
Care less about user installs during test. Resolves #221
2 parents cdf726b + badb414 commit aec1c55

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎tests/commands/install_uninstall_test.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,18 @@ def test_environment_not_sourced(tmpdir_factory):
162162
with mock.patch.object(sys, 'executable', '/bin/false'):
163163
assert install(Runner(path)) == 0
164164

165+
# Use a specific homedir to ignore --user installs
166+
homedir = tmpdir_factory.get()
167+
# Need this so we can call git commit without sploding
168+
with io.open(os.path.join(homedir, '.gitconfig'), 'w') as gitconfig:
169+
gitconfig.write(
170+
'[user]\n'
171+
' name = Travis CI\n'
172+
' email = user@example.com\n'
173+
)
165174
ret, stdout, stderr = cmd_output(
166175
'git', 'commit', '--allow-empty', '-m', 'foo',
167-
env={'HOME': os.path.expanduser('~')},
176+
env={'HOME': homedir},
168177
retcode=None,
169178
)
170179
assert ret == 1

0 commit comments

Comments
 (0)