File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -358,8 +358,11 @@ def make_session(
358
358
calls = Call .generate_calls (func , parametrize )
359
359
for call in calls :
360
360
long_names = []
361
- if not multi :
361
+ if not multi or (
362
+ self ._config .force_pythons and call .python in self ._config .extra_pythons
363
+ ):
362
364
long_names .append (f"{ name } { call .session_signature } " )
365
+
363
366
if func .python :
364
367
long_names .append (f"{ name } -{ func .python } { call .session_signature } " )
365
368
# Ensure that specifying session-python will run all parameterizations.
Original file line number Diff line number Diff line change
1
+ import nox
2
+
3
+
4
+ @nox .session
5
+ @nox .parametrize (
6
+ ["version" ],
7
+ [["8.1.0" ], ["7.5.0" ]],
8
+ ["8.1.0" , "7.5.0" ],
9
+ )
10
+ def check_package_files (session : nox .Session , version : str ):
11
+ pass
Original file line number Diff line number Diff line change @@ -150,6 +150,31 @@ def test_main_no_venv_error() -> None:
150
150
nox .main ()
151
151
152
152
153
+ def test_main_param_force_python (monkeypatch : pytest .MonkeyPatch ) -> None :
154
+ """
155
+ Check that Python can be forced if something is parametrized over other things.
156
+ """
157
+
158
+ # Check that --no-venv overrides force_venv_backend
159
+ monkeypatch .setattr (
160
+ sys ,
161
+ "argv" ,
162
+ [
163
+ "nox" ,
164
+ "--noxfile" ,
165
+ os .path .join (RESOURCES , "noxfile_parametrize.py" ),
166
+ "--sessions" ,
167
+ "check_package_files(7.5.0)" ,
168
+ "--force-python" ,
169
+ "." .join (str (v ) for v in sys .version_info [:2 ]),
170
+ ],
171
+ )
172
+
173
+ with mock .patch ("sys.exit" ) as sys_exit :
174
+ nox .main ()
175
+ sys_exit .assert_called_once_with (0 )
176
+
177
+
153
178
def test_main_short_form_args (monkeypatch : pytest .MonkeyPatch ) -> None :
154
179
monkeypatch .setattr (
155
180
sys ,
You can’t perform that action at this time.
0 commit comments