From badb41457acd49bacc50d7cf8570a736308a3e05 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Tue, 5 May 2015 13:19:48 -0700 Subject: [PATCH] Care less about user installs during test. Resolves #221 --- tests/commands/install_uninstall_test.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/commands/install_uninstall_test.py b/tests/commands/install_uninstall_test.py index 3d3439cf..a9f35342 100644 --- a/tests/commands/install_uninstall_test.py +++ b/tests/commands/install_uninstall_test.py @@ -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