Skip to content

Commit 143270f

Browse files
committed
fixup! feat(config): Allow ranges in envlist
1 parent f8dc100 commit 143270f

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

tests/config/loader/ini/test_factor.py

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,20 @@ def test_factor_config_no_env_list_creates_env(tox_ini_conf: ToxIniCreator) -> N
181181
@pytest.mark.parametrize(
182182
("env_list", "expected_envs"),
183183
[
184-
("py3{10-13}", ["py310", "py311", "py312", "py313"]),
185-
("py3{10-11},a", ["py310", "py311", "a"]),
186-
("py3{10-11},a{1-2}", ["py310", "py311", "a1", "a2"]),
187-
("py3{10-12,14}", ["py310", "py311", "py312", "py314"]),
188-
("py3{8-10,12,14-16}", ["py38", "py39", "py310", "py312", "py314", "py315", "py316"]),
189-
(
184+
pytest.param("py3{10-13}", ["py310", "py311", "py312", "py313"], id="Expand positive range"),
185+
pytest.param("py3{10-11},a", ["py310", "py311", "a"], id="Expand range and add additional env"),
186+
pytest.param("py3{10-11},a{1-2}", ["py310", "py311", "a1", "a2"], id="Expand multiple env with ranges"),
187+
pytest.param(
188+
"py3{10-12,14}",
189+
["py310", "py311", "py312", "py314"],
190+
id="Expand ranges, and allow extra parameter in generator",
191+
),
192+
pytest.param(
193+
"py3{8-10,12,14-16}",
194+
["py38", "py39", "py310", "py312", "py314", "py315", "py316"],
195+
id="Expand multiple ranges for one generator",
196+
),
197+
pytest.param(
190198
"py3{10-11}-django1.{3-5}",
191199
[
192200
"py310-django1.3",
@@ -196,8 +204,9 @@ def test_factor_config_no_env_list_creates_env(tox_ini_conf: ToxIniCreator) -> N
196204
"py311-django1.4",
197205
"py311-django1.5",
198206
],
207+
id="Expand ranges and factor multiple environment parts",
199208
),
200-
(
209+
pytest.param(
201210
"py3{10-11, 13}-django1.{3-4, 6}",
202211
[
203212
"py310-django1.3",
@@ -210,16 +219,22 @@ def test_factor_config_no_env_list_creates_env(tox_ini_conf: ToxIniCreator) -> N
210219
"py313-django1.4",
211220
"py313-django1.6",
212221
],
222+
id="Expand ranges and parameters and factor multiple environment parts",
223+
),
224+
pytest.param(
225+
"py3{10-11},a{1-2}-b{3-4}",
226+
["py310", "py311", "a1-b3", "a1-b4", "a2-b3", "a2-b4"],
227+
id="Expand ranges and parameters & factor multiple environment parts for multiple generative environments",
213228
),
214-
("py3{10-11},a{1-2}-b{3-4}", ["py310", "py311", "a1-b3", "a1-b4", "a2-b3", "a2-b4"]),
215-
("py3{13-11}", ["py313", "py312", "py311"]),
216-
("py3{-11}", ["py3-11"]),
217-
("foo{11-}", ["foo11-"]),
218-
("foo{a-}", ["fooa-"]),
219-
("foo{-a}", ["foo-a"]),
220-
("foo{a-11}", ["fooa-11"]),
221-
("foo{13-a}", ["foo13-a"]),
222-
("foo{a-b}", ["fooa-b"]),
229+
pytest.param("py3{13-11}", ["py313", "py312", "py311"], id="Expand negative ranges"),
230+
pytest.param("3.{10-13}", ["3.10", "3.11", "3.12", "3.13"], id="Expand new-style python envs"),
231+
pytest.param("py3{-11}", ["py3-11"], id="Don't expand left-open numerical range"),
232+
pytest.param("foo{11-}", ["foo11-"], id="Don't expand right-open numerical range"),
233+
pytest.param("foo{a-}", ["fooa-"], id="Don't expand right-open range"),
234+
pytest.param("foo{-a}", ["foo-a"], id="Don't expand left-open range"),
235+
pytest.param("foo{a-11}", ["fooa-11"], id="Don't expand alpha-umerical range"),
236+
pytest.param("foo{13-a}", ["foo13-a"], id="Don't expand numerical-alpha range"),
237+
pytest.param("foo{a-b}", ["fooa-b"], id="Don't expand non-numerical range"),
223238
],
224239
)
225240
def test_env_list_expands_ranges(env_list: str, expected_envs: list[str], tox_ini_conf: ToxIniCreator) -> None:

0 commit comments

Comments
 (0)