Skip to content

Commit f98aadd

Browse files
committed
Have test of refresh that should fail assert command
This extends test_refresh_bad_git_path so that it asserts that the exception message shows the command the failed refresh used. This test fails due to a bug where "git" is always shown (gitpython-developers#1809).
1 parent f241808 commit f98aadd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: test/test_git.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,11 @@ def test_cmd_override(self):
307307
self.assertRaises(GitCommandNotFound, self.git.version)
308308

309309
def test_refresh_bad_git_path(self):
310-
self.assertRaises(GitCommandNotFound, refresh, "yada")
310+
path = "yada"
311+
escaped_abspath = re.escape(str(Path(path).absolute()))
312+
expected_pattern = rf"\n[ \t]*cmdline: {escaped_abspath}\Z"
313+
with self.assertRaisesRegex(GitCommandNotFound, expected_pattern):
314+
refresh(path)
311315

312316
def test_refresh_good_git_path(self):
313317
path = shutil.which("git")

0 commit comments

Comments
 (0)