@@ -74,7 +74,7 @@ def _fake_git(*version_info):
7474 fake_output = f"git version { fake_version } (fake)"
7575
7676 with tempfile .TemporaryDirectory () as tdir :
77- if os . name == "nt " :
77+ if sys . platform == "win32 " :
7878 fake_git = Path (tdir , "fake-git.cmd" )
7979 script = f"@echo { fake_output } \n "
8080 fake_git .write_text (script , encoding = "utf-8" )
@@ -215,7 +215,7 @@ def test_it_executes_git_not_from_cwd(self, rw_dir, case):
215215
216216 repo = Repo .init (rw_dir )
217217
218- if os . name == "nt " :
218+ if sys . platform == "win32 " :
219219 # Copy an actual binary executable that is not git. (On Windows, running
220220 # "hostname" only displays the hostname, it never tries to change it.)
221221 other_exe_path = Path (os .environ ["SystemRoot" ], "system32" , "hostname.exe" )
@@ -228,7 +228,7 @@ def test_it_executes_git_not_from_cwd(self, rw_dir, case):
228228 os .chmod (impostor_path , 0o755 )
229229
230230 if use_shell_impostor :
231- shell_name = "cmd.exe" if os . name == "nt " else "sh"
231+ shell_name = "cmd.exe" if sys . platform == "win32 " else "sh"
232232 shutil .copy (impostor_path , Path (rw_dir , shell_name ))
233233
234234 with contextlib .ExitStack () as stack :
@@ -245,7 +245,7 @@ def test_it_executes_git_not_from_cwd(self, rw_dir, case):
245245 self .assertRegex (output , r"^git version\b" )
246246
247247 @skipUnless (
248- os . name == "nt " ,
248+ sys . platform == "win32 " ,
249249 "The regression only affected Windows, and this test logic is OS-specific." ,
250250 )
251251 def test_it_avoids_upcasing_unrelated_environment_variable_names (self ):
@@ -667,7 +667,7 @@ def test_successful_default_refresh_invalidates_cached_version_info(self):
667667 stack .enter_context (mock .patch .dict (os .environ , {"PATH" : new_path_var }))
668668 stack .enter_context (_patch_out_env ("GIT_PYTHON_GIT_EXECUTABLE" ))
669669
670- if os . name == "nt " :
670+ if sys . platform == "win32 " :
671671 # On Windows, use a shell so "git" finds "git.cmd". (In the infrequent
672672 # case that this effect is desired in production code, it should not be
673673 # done with this technique. USE_SHELL=True is less secure and reliable,
0 commit comments