mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-13 04:20:28 -06:00
Merge pull request #222 from pre-commit/care_less_about_user_installs_in_tests_221
Care less about user installs during test. Resolves #221
This commit is contained in:
@@ -162,9 +162,18 @@ def test_environment_not_sourced(tmpdir_factory):
|
||||
with mock.patch.object(sys, 'executable', '/bin/false'):
|
||||
assert install(Runner(path)) == 0
|
||||
|
||||
# Use a specific homedir to ignore --user installs
|
||||
homedir = tmpdir_factory.get()
|
||||
# Need this so we can call git commit without sploding
|
||||
with io.open(os.path.join(homedir, '.gitconfig'), 'w') as gitconfig:
|
||||
gitconfig.write(
|
||||
'[user]\n'
|
||||
' name = Travis CI\n'
|
||||
' email = user@example.com\n'
|
||||
)
|
||||
ret, stdout, stderr = cmd_output(
|
||||
'git', 'commit', '--allow-empty', '-m', 'foo',
|
||||
env={'HOME': os.path.expanduser('~')},
|
||||
env={'HOME': homedir},
|
||||
retcode=None,
|
||||
)
|
||||
assert ret == 1
|
||||
|
||||
Reference in New Issue
Block a user