mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Care less about user installs during test. Resolves #221
This commit is contained in:
parent
cdf726bbed
commit
badb41457a
1 changed files with 10 additions and 1 deletions
|
|
@ -162,9 +162,18 @@ def test_environment_not_sourced(tmpdir_factory):
|
||||||
with mock.patch.object(sys, 'executable', '/bin/false'):
|
with mock.patch.object(sys, 'executable', '/bin/false'):
|
||||||
assert install(Runner(path)) == 0
|
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(
|
ret, stdout, stderr = cmd_output(
|
||||||
'git', 'commit', '--allow-empty', '-m', 'foo',
|
'git', 'commit', '--allow-empty', '-m', 'foo',
|
||||||
env={'HOME': os.path.expanduser('~')},
|
env={'HOME': homedir},
|
||||||
retcode=None,
|
retcode=None,
|
||||||
)
|
)
|
||||||
assert ret == 1
|
assert ret == 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue