8000 Have test of refresh that should fail assert command · gitpython-developers/GitPython@f98aadd · GitHub
[go: up one dir, main page]

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 (#1809).
1 parent f241808 commit f98aadd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/test_git.py

Lines changed: 5 additions & 1 deletion
< 7B39 td data-grid-cell-id="diff-84c4b72d5c62026240fad69041a453efc37f7336a89035b69672cce0e8beaca1-307-307-1" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative diff-line-number-neutral left-side">307
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,11 @@ def test_cmd_override(self):
307
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)
0