@@ -321,17 +321,17 @@ def test_version(self):
321
321
self .assertIsInstance (n , int )
322
322
# END verify number types
323
323
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
-
332
324
def test_git_exc_name_is_git (self ):
333
325
self .assertEqual (self .git .git_exec_name , "git" )
334
326
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
+
335
335
@ddt .data (("0" ,), ("q" ,), ("quiet" ,), ("s" ,), ("silence" ,), ("silent" ,), ("n" ,), ("none" ,))
336
336
def test_initial_refresh_from_bad_git_path_env_quiet (self , case ):
337
337
"""In "q" mode, bad initial path sets "git" and is quiet."""
0 commit comments