Skip to content

Commit 64c1233

Browse files
committed
session.env_select.CliEnv: Document and test spaces behaviour
It turns out that spaces on either side of environment names in a comma-separated list are considered not part of the environment name and removed. This was neither documented nor tested directly; that's now fixed. (It was and is still also tested in `config.cli.test_cli_ini.test_ini_exhaustive_parallel_values` as well.) The discovery of this was documented in issue tox-dev#3207.
1 parent 47fa093 commit 64c1233

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Diff for: src/tox/session/env_select.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@
2727

2828

2929
class CliEnv: # noqa: PLW1641
30-
"""A `CliEnv` is the user's selection of tox test environments, usually supplied via the ``-e`` command-line
31-
option. It may be treated as a sequence if it's not a "default" or "all" selection.
30+
"""A `CliEnv` is the user's selection of tox test environments, usually supplied via the ``-e`` command-line option
31+
or in a TOML file (typically ``env_list`` in ``tox.ini``). It may be treated as a sequence if it's not a "default"
32+
or "all" selection.
3233
3334
It is in one of three forms:
3435
3536
- A list of specific environments, instantiated with a string that is a comma-separated list of the environment
36-
names. As a sequence this will be a sequence of those names.
37+
names. (These may have spaces on either side of the commas which are removed.) As a sequence this will be a
38+
sequence of those names.
3739
3840
- "ALL" which is all environments defined by the tox configuration. This is instantiated with ``ALL`` either
3941
alone or as any element of a comma-separated list; any other environment names are ignored. `is_all()` will be

Diff for: tests/session/test_env_select.py

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
("", (), False, True),
2424
("a1", ("a1",), False, False),
2525
("a1,b2,c3", ("a1", "b2", "c3"), False, False),
26+
(" a1, b2 , c3 ", ("a1", "b2", "c3"), False, False),
2627
# If the user gives "ALL" as any envname, this becomes an "is_all" and other envnames are ignored.
2728
("ALL", (), True, False),
2829
("a1,ALL,b2", (), True, False),

0 commit comments

Comments
 (0)