Skip to content

Omit warning prefix in "Bad git executable" message #1816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Extend test_cmd_override to test exception's command attribute
  • Loading branch information
EliahKagan committed Feb 6, 2024
commit 85ef145b06e6eb164bc469f72b96a917c567c85a
16 changes: 8 additions & 8 deletions test/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,17 @@ def test_version(self):
self.assertIsInstance(n, int)
# END verify number types

def test_cmd_override(self):
with mock.patch.object(
type(self.git),
"GIT_PYTHON_GIT_EXECUTABLE",
osp.join("some", "path", "which", "doesn't", "exist", "gitbinary"),
):
self.assertRaises(GitCommandNotFound, self.git.version)

def test_git_exc_name_is_git(self):
self.assertEqual(self.git.git_exec_name, "git")

def test_cmd_override(self):
"""Directly set bad GIT_PYTHON_GIT_EXECUTABLE causes git operations to raise."""
bad_path = osp.join("some", "path", "which", "doesn't", "exist", "gitbinary")
with mock.patch.object(type(self.git), "GIT_PYTHON_GIT_EXECUTABLE", bad_path):
with self.assertRaises(GitCommandNotFound) as ctx:
self.git.version()
self.assertEqual(ctx.exception.command, [bad_path, "version"])

@ddt.data(("0",), ("q",), ("quiet",), ("s",), ("silence",), ("silent",), ("n",), ("none",))
def test_initial_refresh_from_bad_git_path_env_quiet(self, case):
"""In "q" mode, bad initial path sets "git" and is quiet."""
Expand Down