Skip to content

Commit 3c1c29a

Browse files
authored
Only respect ALL environments when not in parallel (#2207)
1 parent 9f789a7 commit 3c1c29a

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

docs/changelog/2167.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed handling of ``-e ALL`` in parallel mode by ignoring the ``ALL`` in subprocesses -- by :user:`guahki`.

src/tox/config/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,9 +1498,10 @@ def _getenvdata(self, reader, config):
14981498

14991499
env_list = []
15001500
envlist_explicit = False
1501-
if (from_option and "ALL" in from_option) or (
1502-
not from_option and from_environ and "ALL" in from_environ.split(",")
1503-
):
1501+
if (
1502+
(from_option and "ALL" in from_option)
1503+
or (not from_option and from_environ and "ALL" in from_environ.split(","))
1504+
) and PARALLEL_ENV_VAR_KEY_PRIVATE not in os.environ:
15041505
all_envs = self._getallenvs(reader)
15051506
else:
15061507
candidates = (

tests/unit/config/test_config_parallel.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import pytest
22

3+
from tox.config.parallel import ENV_VAR_KEY_PRIVATE as PARALLEL_ENV_VAR_KEY_PRIVATE
4+
35

46
def test_parallel_default(newconfig):
57
config = newconfig([], "")
@@ -70,3 +72,17 @@ def test_depends_factor(newconfig):
7072
""",
7173
)
7274
assert config.envconfigs["py"].depends == ("py37-cov", "py37-no", "py36-cov", "py36-no")
75+
76+
77+
def test_parallel_env_selection_with_ALL(newconfig, monkeypatch):
78+
# Regression test for #2167
79+
inisource = """
80+
[tox]
81+
envlist = py,lint
82+
"""
83+
monkeypatch.setenv(PARALLEL_ENV_VAR_KEY_PRIVATE, "py")
84+
config = newconfig(["-eALL"], inisource)
85+
assert config.envlist == ["py"]
86+
monkeypatch.setenv(PARALLEL_ENV_VAR_KEY_PRIVATE, "lint")
87+
config = newconfig(["-eALL"], inisource)
88+
assert config.envlist == ["lint"]

0 commit comments

Comments
 (0)