@@ -120,7 +120,8 @@ async def test_checkout_branch_noref_failure():
120120
121121@pytest .mark .asyncio
122122async def test_checkout_branch_remoteref_success ():
123- branch = "test-branch"
123+ branch = "origin/test-branch"
124+ local_branch = "test-branch"
124125 curr_path = str (Path ("/bin/test_curr_path" ))
125126 stdout_message = "checkout output from git"
126127 stderr_message = ""
@@ -145,7 +146,7 @@ async def test_checkout_branch_remoteref_success():
145146 # Then
146147 mock__get_branch_reference .assert_has_calls ([call (branch , curr_path )])
147148
148- cmd = ["git" , "checkout" , "--track" , branch ]
149+ cmd = ["git" , "checkout" , "-B" , local_branch , branch ]
149150 mock_execute .assert_called_once_with (
150151 cmd ,
151152 cwd = str (Path ("/bin" ) / "test_curr_path" ),
@@ -229,7 +230,8 @@ async def test_checkout_branch_headsref_success():
229230
230231@pytest .mark .asyncio
231232async def test_checkout_branch_remoteref_failure ():
232- branch = "test-branch"
233+ branch = "origin/test-branch"
234+ local_branch = "test-branch"
233235 stdout_message = ""
234236 stderr_message = (
235237 "error: pathspec '{}' did not match any file(s) known to git" .format (branch )
@@ -253,7 +255,7 @@ async def test_checkout_branch_remoteref_failure():
253255 )
254256
255257 # Then
256- cmd = ["git" , "checkout" , "--track" , branch ]
258+ cmd = ["git" , "checkout" , "-B" , local_branch , branch ]
257259 mock_execute .assert_called_once_with (
258260 cmd ,
259261 cwd = str (Path ("/bin" ) / "test_curr_path" ),
0 commit comments