Skip to content

Commit 85ef145

Browse files
committed
Extend test_cmd_override to test exception's command attribute
1 parent db6fb90 commit 85ef145

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/test_git.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,17 +321,17 @@ def test_version(self):
321321
self.assertIsInstance(n, int)
322322
# END verify number types
323323

324-
def test_cmd_override(self):
325-
with mock.patch.object(
326-
type(self.git),
327-
"GIT_PYTHON_GIT_EXECUTABLE",
328-
osp.join("some", "path", "which", "doesn't", "exist", "gitbinary"),
329-
):
330-
self.assertRaises(GitCommandNotFound, self.git.version)
331-
332324
def test_git_exc_name_is_git(self):
333325
self.assertEqual(self.git.git_exec_name, "git")
334326

327+
def test_cmd_override(self):
328+
"""Directly set bad GIT_PYTHON_GIT_EXECUTABLE causes git operations to raise."""
329+
bad_path = osp.join("some", "path", "which", "doesn't", "exist", "gitbinary")
330+
with mock.patch.object(type(self.git), "GIT_PYTHON_GIT_EXECUTABLE", bad_path):
331+
with self.assertRaises(GitCommandNotFound) as ctx:
332+
self.git.version()
333+
self.assertEqual(ctx.exception.command, [bad_path, "version"])
334+
335335
@ddt.data(("0",), ("q",), ("quiet",), ("s",), ("silence",), ("silent",), ("n",), ("none",))
336336
def test_initial_refresh_from_bad_git_path_env_quiet(self, case):
337337
"""In "q" mode, bad initial path sets "git" and is quiet."""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy