3838
3939 from nox .virtualenv import CondaEnv , ProcessEnv , VirtualEnv
4040
41- IS_WINDOWS = nox . virtualenv . _SYSTEM == "Windows"
41+ IS_WINDOWS = sys . platform . startswith ( "win" )
4242HAS_CONDA = shutil .which ("conda" ) is not None
4343HAS_UV = shutil .which ("uv" ) is not None
4444RAISE_ERROR = "RAISE_ERROR"
@@ -249,7 +249,7 @@ def test_conda_env_create_verbose(
249249 assert kwargs ["log" ]
250250
251251
252- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Windows " )
252+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "win32 " )
253253def test_condaenv_bin_windows (make_conda : Callable [..., tuple [CondaEnv , Path ]]) -> None :
254254 venv , dir_ = make_conda ()
255255 assert [
@@ -406,7 +406,7 @@ def test_bin_paths(
406406 assert str (dir_ .joinpath ("Scripts" if IS_WINDOWS else "bin" )) == venv .bin
407407
408408
409- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Windows " )
409+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "win32 " )
410410def test_bin_windows (
411411 make_one : Callable [..., tuple [VirtualEnv | ProcessEnv , Path ]],
412412) -> None :
@@ -899,7 +899,7 @@ def test__resolved_interpreter_none(
899899 ("2.7.15" , "python2.7" ),
900900 ],
901901)
902- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Linux " )
902+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "linux " )
903903@mock .patch .object (shutil , "which" , return_value = True )
904904def test__resolved_interpreter_numerical_non_windows (
905905 which : mock .Mock ,
@@ -914,7 +914,7 @@ def test__resolved_interpreter_numerical_non_windows(
914914
915915
916916@pytest .mark .parametrize ("input_" , ["2." , "2.7." ])
917- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Linux " )
917+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "linux " )
918918@mock .patch .object (shutil , "which" , return_value = False )
919919def test__resolved_interpreter_invalid_numerical_id (
920920 which : mock .Mock ,
@@ -929,7 +929,7 @@ def test__resolved_interpreter_invalid_numerical_id(
929929 which .assert_called_once_with (input_ )
930930
931931
932- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Linux " )
932+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "linux " )
933933@mock .patch .object (shutil , "which" , return_value = False )
934934def test__resolved_interpreter_32_bit_non_windows (
935935 which : mock .Mock , make_one : Callable [..., tuple [VirtualEnv , Path ]]
@@ -941,7 +941,7 @@ def test__resolved_interpreter_32_bit_non_windows(
941941 which .assert_called_once_with ("3.6-32" )
942942
943943
944- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Linux " )
944+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "linux " )
945945@mock .patch .object (shutil , "which" , return_value = True )
946946def test__resolved_interpreter_non_windows (
947947 which : mock .Mock , make_one : Callable [..., tuple [VirtualEnv , Path ]]
@@ -954,7 +954,7 @@ def test__resolved_interpreter_non_windows(
954954 which .assert_called_once_with ("python3.6" )
955955
956956
957- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Windows " )
957+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "win32 " )
958958@mock .patch .object (shutil , "which" )
959959def test__resolved_interpreter_windows_full_path (
960960 which : mock .Mock , make_one : Callable [..., tuple [VirtualEnv , Path ]]
@@ -976,7 +976,7 @@ def test__resolved_interpreter_windows_full_path(
976976 ("2.7-32" , r"c:\python27\python.exe" ),
977977 ],
978978)
979- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Windows " )
979+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "win32 " )
980980@mock .patch .object (subprocess , "run" )
981981@mock .patch .object (shutil , "which" )
982982def test__resolved_interpreter_windows_pyexe (
@@ -1011,7 +1011,7 @@ def special_run(cmd: str, *args: str, **kwargs: object) -> TextProcessResult:
10111011 which .assert_has_calls ([mock .call (input_ ), mock .call ("py" )])
10121012
10131013
1014- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Windows " )
1014+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "win32 " )
10151015@mock .patch .object (subprocess , "run" )
10161016@mock .patch .object (shutil , "which" )
10171017def test__resolved_interpreter_windows_pyexe_fails (
@@ -1020,8 +1020,8 @@ def test__resolved_interpreter_windows_pyexe_fails(
10201020 # Establish that if the py launcher fails, we give the right error.
10211021 venv , _ = make_one (interpreter = "python3.6" )
10221022
1023- # Trick the nox.virtualenv._SYSTEM into thinking that it cannot find python3.6
1024- # (it likely will on Unix). Also, when the nox.virtualenv._SYSTEM looks for the
1023+ # Trick the nox.virtualenv into thinking that it cannot find python3.6
1024+ # (it likely will on Unix). Also, when the nox.virtualenv looks for the
10251025 # py launcher, give it a dummy that fails.
10261026 def special_run (cmd : str , * args : str , ** kwargs : object ) -> TextProcessResult : # noqa: ARG001
10271027 return TextProcessResult ("" , 1 )
@@ -1036,7 +1036,7 @@ def special_run(cmd: str, *args: str, **kwargs: object) -> TextProcessResult: #
10361036 which .assert_has_calls ([mock .call ("python3.6" ), mock .call ("py" )])
10371037
10381038
1039- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Windows " )
1039+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "win32 " )
10401040@mock .patch ("nox.virtualenv.UV_PYTHON_SUPPORT" , new = False )
10411041def test__resolved_interpreter_windows_path_and_version (
10421042 make_one : Callable [..., tuple [VirtualEnv , Path ]],
@@ -1065,7 +1065,7 @@ def test__resolved_interpreter_windows_path_and_version(
10651065@pytest .mark .parametrize ("input_" , ["2.7" , "python3.7" , "goofy" ])
10661066@pytest .mark .parametrize ("sysfind_result" , [r"c:\python37-x64\python.exe" , None ])
10671067@pytest .mark .parametrize ("sysexec_result" , ["3.7.3\\ n" , RAISE_ERROR ])
1068- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Windows " )
1068+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "win32 " )
10691069@mock .patch ("nox.virtualenv.UV_PYTHON_SUPPORT" , new = False )
10701070def test__resolved_interpreter_windows_path_and_version_fails (
10711071 input_ : str ,
@@ -1089,7 +1089,7 @@ def test__resolved_interpreter_windows_path_and_version_fails(
10891089 print (venv ._resolved_interpreter )
10901090
10911091
1092- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Windows " )
1092+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "win32 " )
10931093@mock .patch .object (shutil , "which" )
10941094def test__resolved_interpreter_not_found (
10951095 which : mock .Mock , make_one : Callable [..., tuple [VirtualEnv , Path ]]
@@ -1106,7 +1106,7 @@ def test__resolved_interpreter_not_found(
11061106 print (venv ._resolved_interpreter )
11071107
11081108
1109- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Windows " )
1109+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "win32 " )
11101110@mock .patch ("nox.virtualenv.locate_via_py" , new = lambda _ : None ) # type: ignore[misc] # noqa: PT008
11111111def test__resolved_interpreter_nonstandard (
11121112 make_one : Callable [..., tuple [VirtualEnv , Path ]],
@@ -1119,7 +1119,7 @@ def test__resolved_interpreter_nonstandard(
11191119 print (venv ._resolved_interpreter )
11201120
11211121
1122- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Linux " )
1122+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "linux " )
11231123@mock .patch .object (shutil , "which" , return_value = True )
11241124def test__resolved_interpreter_cache_result (
11251125 which : mock .Mock , make_one : Callable [..., tuple [VirtualEnv , Path ]]
@@ -1135,7 +1135,7 @@ def test__resolved_interpreter_cache_result(
11351135 assert which .call_count == 1
11361136
11371137
1138- @mock .patch ("nox.virtualenv._SYSTEM " , new = "Linux " )
1138+ @mock .patch ("nox.virtualenv._PLATFORM " , new = "linux " )
11391139@mock .patch .object (shutil , "which" , return_value = None )
11401140def test__resolved_interpreter_cache_failure (
11411141 which : mock .Mock , make_one : Callable [..., tuple [VirtualEnv , Path ]]
0 commit comments