Skip to content

Commit a392768

Browse files
authored
Skip section generated by isolated_build
Skip the section generated by `isolated_build = true` when collection all environments instead of removing the `isolated_build_env` afterwards. Fixes #2474
1 parent 82c26ed commit a392768

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/tox/config/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ def make_envconfig(self, name, section, subs, config, replace=True):
14841484
reader.addsubstitutions(**{env_attr.name: res})
14851485
return tc
14861486

1487-
def _getallenvs(self, reader, extra_env_list=None):
1487+
def _getallenvs(self, reader, config, extra_env_list=None):
14881488
extra_env_list = extra_env_list or []
14891489
env_str = reader.getstring("envlist", replace=False)
14901490
env_list = _split_env(env_str)
@@ -1493,9 +1493,12 @@ def _getallenvs(self, reader, extra_env_list=None):
14931493
env_list.append(env)
14941494

14951495
all_envs = OrderedDict((i, None) for i in env_list)
1496+
package_env = config.isolated_build_env if config.isolated_build is True else None
14961497
for section in self._cfg:
14971498
if section.name.startswith(testenvprefix):
1498-
all_envs[section.name[len(testenvprefix) :]] = None
1499+
section_env = section.name[len(testenvprefix) :]
1500+
if section_env != package_env:
1501+
all_envs[section_env] = None
14991502
if not all_envs:
15001503
all_envs["python"] = None
15011504
return list(all_envs.keys())
@@ -1511,7 +1514,7 @@ def _getenvdata(self, reader, config):
15111514
(from_option and "ALL" in from_option)
15121515
or (not from_option and from_environ and "ALL" in from_environ.split(","))
15131516
) and PARALLEL_ENV_VAR_KEY_PRIVATE not in os.environ:
1514-
all_envs = self._getallenvs(reader)
1517+
all_envs = self._getallenvs(reader, config)
15151518
else:
15161519
candidates = (
15171520
(os.environ.get(PARALLEL_ENV_VAR_KEY_PRIVATE), True),
@@ -1522,7 +1525,7 @@ def _getenvdata(self, reader, config):
15221525
)
15231526
env_str, envlist_explicit = next(((i, e) for i, e in candidates if i), ([], False))
15241527
env_list = _split_env(env_str)
1525-
all_envs = self._getallenvs(reader, env_list)
1528+
all_envs = self._getallenvs(reader, config, env_list)
15261529

15271530
if not env_list:
15281531
env_list = all_envs
@@ -1533,9 +1536,6 @@ def _getenvdata(self, reader, config):
15331536
raise tox.exception.ConfigError(msg)
15341537

15351538
package_env = config.isolated_build_env
1536-
if config.isolated_build is True and package_env in all_envs:
1537-
all_envs.remove(package_env)
1538-
15391539
if config.isolated_build is True and package_env in env_list:
15401540
msg = "isolated_build_env {} cannot be part of envlist".format(package_env)
15411541
raise tox.exception.ConfigError(msg)

0 commit comments

Comments
 (0)