@@ -27,14 +27,21 @@ def next_tox_major():
27
27
return "10.0.0"
28
28
29
29
30
- def test_provision_min_version_is_requires (newconfig , next_tox_major ):
30
+ @pytest .fixture (scope = "session" , params = ["minversion" , "min_version" ])
31
+ def minversion_option (request ):
32
+ """both possible names for the minversion config option"""
33
+ return request .param
34
+
35
+
36
+ def test_provision_min_version_is_requires (newconfig , minversion_option , next_tox_major ):
31
37
with pytest .raises (MissingRequirement ) as context :
32
38
newconfig (
33
39
[],
34
40
"""\
35
41
[tox]
36
- minversion = {}
42
+ {} = {}
37
43
""" .format (
44
+ minversion_option ,
38
45
next_tox_major ,
39
46
),
40
47
)
@@ -49,17 +56,20 @@ def test_provision_min_version_is_requires(newconfig, next_tox_major):
49
56
assert config .ignore_basepython_conflict is False
50
57
51
58
52
- def test_provision_config_has_minversion_and_requires (newconfig , next_tox_major ):
59
+ def test_provision_config_has_minversion_and_requires (
60
+ newconfig , minversion_option , next_tox_major
61
+ ):
53
62
with pytest .raises (MissingRequirement ) as context :
54
63
newconfig (
55
64
[],
56
65
"""\
57
66
[tox]
58
- minversion = {}
67
+ {} = {}
59
68
requires =
60
69
setuptools > 2
61
70
pip > 3
62
71
""" .format (
72
+ minversion_option ,
63
73
next_tox_major ,
64
74
),
65
75
)
@@ -89,17 +99,18 @@ def test_provision_tox_change_name(newconfig):
89
99
assert config .provision_tox_env == "magic"
90
100
91
101
92
- def test_provision_basepython_global_only (newconfig , next_tox_major ):
102
+ def test_provision_basepython_global_only (newconfig , minversion_option , next_tox_major ):
93
103
"""we don't want to inherit basepython from global"""
94
104
with pytest .raises (MissingRequirement ) as context :
95
105
newconfig (
96
106
[],
97
107
"""\
98
108
[tox]
99
- minversion = {}
109
+ {} = {}
100
110
[testenv]
101
111
basepython = what
102
112
""" .format (
113
+ minversion_option ,
103
114
next_tox_major ,
104
115
),
105
116
)
@@ -108,17 +119,18 @@ def test_provision_basepython_global_only(newconfig, next_tox_major):
108
119
assert base_python == sys .executable
109
120
110
121
111
- def test_provision_basepython_local (newconfig , next_tox_major ):
122
+ def test_provision_basepython_local (newconfig , minversion_option , next_tox_major ):
112
123
"""however adhere to basepython when explicitly set"""
113
124
with pytest .raises (MissingRequirement ) as context :
114
125
newconfig (
115
126
[],
116
127
"""\
117
128
[tox]
118
- minversion = {}
129
+ {} = {}
119
130
[testenv:.tox]
120
131
basepython = what
121
132
""" .format (
133
+ minversion_option ,
122
134
next_tox_major ,
123
135
),
124
136
)
@@ -199,14 +211,17 @@ def test_provision_does_not_fail_with_no_provision_no_reason(cmd, initproj, json
199
211
200
212
201
213
@parametrize_json_path
202
- def test_provision_fails_with_no_provision_next_tox (cmd , initproj , next_tox_major , json_path ):
214
+ def test_provision_fails_with_no_provision_next_tox (
215
+ cmd , initproj , minversion_option , next_tox_major , json_path
216
+ ):
203
217
p = initproj (
204
218
"test-0.1" ,
205
219
{
206
220
"tox.ini" : """\
207
221
[tox]
208
- minversion = {}
222
+ {} = {}
209
223
""" .format (
224
+ minversion_option ,
210
225
next_tox_major ,
211
226
)
212
227
},
@@ -238,17 +253,21 @@ def test_provision_fails_with_no_provision_missing_requires(cmd, initproj, json_
238
253
239
254
240
255
@parametrize_json_path
241
- def test_provision_does_not_fail_with_satisfied_requires (cmd , initproj , next_tox_major , json_path ):
256
+ def test_provision_does_not_fail_with_satisfied_requires (
257
+ cmd , initproj , minversion_option , json_path
258
+ ):
242
259
p = initproj (
243
260
"test-0.1" ,
244
261
{
245
262
"tox.ini" : """\
246
263
[tox]
247
- minversion = 0
264
+ {} = 0
248
265
requires =
249
266
setuptools > 2
250
267
pip > 3
251
- """
268
+ """ .format (
269
+ minversion_option
270
+ )
252
271
},
253
272
)
254
273
result = cmd ("--no-provision" , * ([json_path ] if json_path else []))
@@ -257,17 +276,20 @@ def test_provision_does_not_fail_with_satisfied_requires(cmd, initproj, next_tox
257
276
258
277
259
278
@parametrize_json_path
260
- def test_provision_fails_with_no_provision_combined (cmd , initproj , next_tox_major , json_path ):
279
+ def test_provision_fails_with_no_provision_combined (
280
+ cmd , initproj , minversion_option , next_tox_major , json_path
281
+ ):
261
282
p = initproj (
262
283
"test-0.1" ,
263
284
{
264
285
"tox.ini" : """\
265
286
[tox]
266
- minversion = {}
287
+ {} = {}
267
288
requires =
268
289
setuptools > 2
269
290
pip > 3
270
291
""" .format (
292
+ minversion_option ,
271
293
next_tox_major ,
272
294
)
273
295
},
@@ -389,15 +411,16 @@ def space_path2url(path):
389
411
return urljoin ("file:" , pathname2url (os .path .abspath (at_path )))
390
412
391
413
392
- def test_provision_does_not_occur_in_devenv (newconfig , next_tox_major ):
414
+ def test_provision_does_not_occur_in_devenv (newconfig , minversion_option , next_tox_major ):
393
415
"""Adding --devenv should not change the directory where provisioning occurs"""
394
416
with pytest .raises (MissingRequirement ) as context :
395
417
newconfig (
396
418
["--devenv" , "my_devenv" ],
397
419
"""\
398
420
[tox]
399
- minversion = {}
421
+ {} = {}
400
422
""" .format (
423
+ minversion_option ,
401
424
next_tox_major ,
402
425
),
403
426
)
0 commit comments