Skip to content

Commit

Permalink
Only respect ALL environments when not in parallel (#2207)
Browse files Browse the repository at this point in the history
  • Loading branch information
guahki authored Sep 13, 2021
1 parent 9f789a7 commit 3c1c29a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog/2167.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed handling of ``-e ALL`` in parallel mode by ignoring the ``ALL`` in subprocesses -- by :user:`guahki`.
7 changes: 4 additions & 3 deletions src/tox/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,9 +1498,10 @@ def _getenvdata(self, reader, config):

env_list = []
envlist_explicit = False
if (from_option and "ALL" in from_option) or (
not from_option and from_environ and "ALL" in from_environ.split(",")
):
if (
(from_option and "ALL" in from_option)
or (not from_option and from_environ and "ALL" in from_environ.split(","))
) and PARALLEL_ENV_VAR_KEY_PRIVATE not in os.environ:
all_envs = self._getallenvs(reader)
else:
candidates = (
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/config/test_config_parallel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest

from tox.config.parallel import ENV_VAR_KEY_PRIVATE as PARALLEL_ENV_VAR_KEY_PRIVATE


def test_parallel_default(newconfig):
config = newconfig([], "")
Expand Down Expand Up @@ -70,3 +72,17 @@ def test_depends_factor(newconfig):
""",
)
assert config.envconfigs["py"].depends == ("py37-cov", "py37-no", "py36-cov", "py36-no")


def test_parallel_env_selection_with_ALL(newconfig, monkeypatch):
# Regression test for #2167
inisource = """
[tox]
envlist = py,lint
"""
monkeypatch.setenv(PARALLEL_ENV_VAR_KEY_PRIVATE, "py")
config = newconfig(["-eALL"], inisource)
assert config.envlist == ["py"]
monkeypatch.setenv(PARALLEL_ENV_VAR_KEY_PRIVATE, "lint")
config = newconfig(["-eALL"], inisource)
assert config.envlist == ["lint"]

0 comments on commit 3c1c29a

Please sign in to comment.