From b4459ca7fd21d549a2342a902cfdeba10c76a022 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 28 Nov 2017 11:59:21 -0500 Subject: BF(WIN): use where instead of which while looking for git --- git/test/test_git.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'git/test/test_git.py') diff --git a/git/test/test_git.py b/git/test/test_git.py index 0a0d7ef7..21ef52da 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -37,6 +37,8 @@ try: except ImportError: import mock +from git.compat import is_win + class TestGit(TestBase): @@ -177,7 +179,8 @@ class TestGit(TestBase): self.assertRaises(GitCommandNotFound, refresh, "yada") # test a good path refresh - path = os.popen("which git").read().strip() + which_cmd = "where" if is_win else "which" + path = os.popen("{0} git".format(which_cmd)).read().strip() refresh(path) def test_options_are_passed_to_git(self): -- cgit v1.2.1 From 4d851a6f3885ec24a963a206f77790977fd2e6c5 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 28 Nov 2017 13:14:10 -0500 Subject: BF(WIN): where could report multiple hits, so choose first --- git/test/test_git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/test/test_git.py') diff --git a/git/test/test_git.py b/git/test/test_git.py index 21ef52da..059f90c0 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -180,7 +180,7 @@ class TestGit(TestBase): # test a good path refresh which_cmd = "where" if is_win else "which" - path = os.popen("{0} git".format(which_cmd)).read().strip() + path = os.popen("{0} git".format(which_cmd)).read().strip().split('\n')[0] refresh(path) def test_options_are_passed_to_git(self): -- cgit v1.2.1