Skip to content

Commit

Permalink
Have test of refresh that should fail assert command
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
EliahKagan committed Jan 24, 2024
1 parent f241808 commit f98aadd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ def test_cmd_override(self):
self.assertRaises(GitCommandNotFound, self.git.version)

def test_refresh_bad_git_path(self):
self.assertRaises(GitCommandNotFound, refresh, "yada")
path = "yada"
escaped_abspath = re.escape(str(Path(path).absolute()))
expected_pattern = rf"\n[ \t]*cmdline: {escaped_abspath}\Z"
with self.assertRaisesRegex(GitCommandNotFound, expected_pattern):
refresh(path)

def test_refresh_good_git_path(self):
path = shutil.which("git")
Expand Down

0 comments on commit f98aadd

Please sign in to comment.