88
99from botocore .stub import ANY
1010from e3 .mock .os .process import mock_run , CommandResult
11+ from e3 .os .process import which
1112from e3 .aws import AWSEnv , default_region
1213from e3 .aws .cfn import Stack
1314from e3 .aws .cfn .main import CFNMain
@@ -235,13 +236,14 @@ class MyCFNMain(CFNMain):
235236 def create_stack (self ) -> Stack :
236237 return Stack (name = "teststack" )
237238
239+ git_path = which ("git" , default = "/usr/bin/git" )
238240 with mock_run (
239241 config = {
240242 "results" : [
241243 # Make CFNMain think we are on main
242244 CommandResult (
243245 cmd = [
244- "/usr/bin/git" ,
246+ git_path ,
245247 "-c" ,
246248 "fetch.prune=false" ,
247249 "branch" ,
@@ -252,7 +254,7 @@ def create_stack(self) -> Stack:
252254 # Make CFNMain detect some local changes
253255 CommandResult (
254256 cmd = [
255- "/usr/bin/git" ,
257+ git_path ,
256258 "-c" ,
257259 "fetch.prune=false" ,
258260 "status" ,
@@ -279,13 +281,14 @@ class MyCFNMain(CFNMain):
279281 def create_stack (self ) -> Stack :
280282 return Stack (name = "teststack" )
281283
284+ git_path = which ("git" , default = "/usr/bin/git" )
282285 with mock_run (
283286 config = {
284287 "results" : [
285288 # Make CFNMain detect an incorrect branch
286289 CommandResult (
287290 cmd = [
288- "/usr/bin/git" ,
291+ git_path ,
289292 "-c" ,
290293 "fetch.prune=false" ,
291294 "branch" ,
@@ -364,13 +367,14 @@ def create_stack(self) -> Stack:
364367 )
365368 stubber .add_response ("describe_stacks" , {}, {"StackName" : "teststack" })
366369
370+ git_path = which ("git" , default = "/usr/bin/git" )
367371 with default_region ("us-east-1" ), stubber , mock_run (
368372 config = {
369373 "results" : [
370374 # Make CFNMain think we are on main
371375 CommandResult (
372376 cmd = [
373- "/usr/bin/git" ,
377+ git_path ,
374378 "-c" ,
375379 "fetch.prune=false" ,
376380 "branch" ,
@@ -381,7 +385,7 @@ def create_stack(self) -> Stack:
381385 # Make CFNMain detect no local changes
382386 CommandResult (
383387 cmd = [
384- "/usr/bin/git" ,
388+ git_path ,
385389 "-c" ,
386390 "fetch.prune=false" ,
387391 "status" ,
@@ -391,7 +395,7 @@ def create_stack(self) -> Stack:
391395 # Make CFNMain detect an outdated branch
392396 CommandResult (
393397 cmd = [
394- "/usr/bin/git" ,
398+ git_path ,
395399 "-c" ,
396400 "fetch.prune=false" ,
397401 "fetch" ,
0 commit comments