16
16
17
17
import contextlib
18
18
import os
19
+ import shutil
19
20
import subprocess
20
21
import sys
21
22
from importlib import metadata
@@ -527,12 +528,18 @@ def test_main_with_bad_session_names(
527
528
assert session in stderr
528
529
529
530
531
+ py39py310 = pytest .mark .skipif (
532
+ shutil .which ("python3.10" ) is None or shutil .which ("python3.9" ) is None ,
533
+ reason = "Python 3.9 and 3.10 required" ,
534
+ )
535
+
536
+
530
537
@pytest .mark .parametrize (
531
538
("sessions" , "expected_order" ),
532
539
[
533
540
(("g" , "a" , "d" ), ("b" , "c" , "h" , "g" , "a" , "e" , "d" )),
534
- (("m" ,), ("k-3.9" , "k-3.10" , "m" )),
535
- (("n" ,), ("k-3.10" , "n" )),
541
+ pytest . param (("m" ,), ("k-3.9" , "k-3.10" , "m" ), marks = py39py310 ),
542
+ pytest . param (("n" ,), ("k-3.10" , "n" ), marks = py39py310 ),
536
543
(("v" ,), ("u(django='1.9')" , "u(django='2.0')" , "v" )),
537
544
(("w" ,), ("u(django='1.9')" , "u(django='2.0')" , "w" )),
538
545
],
@@ -1022,7 +1029,8 @@ def test_symlink_sym_not(monkeypatch: pytest.MonkeyPatch) -> None:
1022
1029
assert res .returncode == 1
1023
1030
1024
1031
1025
- def test_noxfile_script_mode () -> None :
1032
+ def test_noxfile_script_mode (monkeypatch : pytest .MonkeyPatch ) -> None :
1033
+ monkeypatch .delenv ("NOX_SCRIPT_MODE" , raising = False )
1026
1034
job = subprocess .run (
1027
1035
[
1028
1036
sys .executable ,
@@ -1044,9 +1052,8 @@ def test_noxfile_script_mode() -> None:
1044
1052
assert "hello_world" in job .stdout
1045
1053
1046
1054
1047
- def test_noxfile_no_script_mode () -> None :
1048
- env = os .environ .copy ()
1049
- env ["NOX_SCRIPT_MODE" ] = "none"
1055
+ def test_noxfile_no_script_mode (monkeypatch : pytest .MonkeyPatch ) -> None :
1056
+ monkeypatch .setenv ("NOX_SCRIPT_MODE" , "none" )
1050
1057
job = subprocess .run (
1051
1058
[
1052
1059
sys .executable ,
@@ -1057,7 +1064,6 @@ def test_noxfile_no_script_mode() -> None:
1057
1064
"-s" ,
1058
1065
"example" ,
1059
1066
],
1060
- env = env ,
1061
1067
check = False ,
1062
1068
capture_output = True ,
1063
1069
text = True ,
0 commit comments