Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only respect ALL environments when not in parallel #2207

Merged
merged 1 commit into from Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions 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`.
7 changes: 4 additions & 3 deletions src/tox/config/__init__.py
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
@@ -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"]