summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguahki <85439599+guahki@users.noreply.github.com>2021-09-13 21:17:52 +0200
committerGitHub <noreply@github.com>2021-09-13 20:17:52 +0100
commit3c1c29ab609bf4471d5bf5598585cd76fa890c71 (patch)
tree720c9702d6d9b67f7163cd5c8695bbdb765d0e58
parent9f789a770a706bfea0e59181252a68f7d43b5481 (diff)
downloadtox-git-3c1c29ab609bf4471d5bf5598585cd76fa890c71.tar.gz
Only respect ALL environments when not in parallel (#2207)
-rw-r--r--docs/changelog/2167.bugfix.rst1
-rw-r--r--src/tox/config/__init__.py7
-rw-r--r--tests/unit/config/test_config_parallel.py16
3 files changed, 21 insertions, 3 deletions
diff --git a/docs/changelog/2167.bugfix.rst b/docs/changelog/2167.bugfix.rst
new file mode 100644
index 00000000..1d280247
--- /dev/null
+++ b/docs/changelog/2167.bugfix.rst
@@ -0,0 +1 @@
+Fixed handling of ``-e ALL`` in parallel mode by ignoring the ``ALL`` in subprocesses -- by :user:`guahki`.
diff --git a/src/tox/config/__init__.py b/src/tox/config/__init__.py
index 54dbf0bd..b51c8633 100644
--- a/src/tox/config/__init__.py
+++ b/src/tox/config/__init__.py
@@ -1498,9 +1498,10 @@ class ParseIni(object):
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 = (
diff --git a/tests/unit/config/test_config_parallel.py b/tests/unit/config/test_config_parallel.py
index 0e42a2c5..f070ca80 100644
--- a/tests/unit/config/test_config_parallel.py
+++ b/tests/unit/config/test_config_parallel.py
@@ -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([], "")
@@ -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"]