Skip to content

Commit 386dad4

Browse files
committed
env_select: ignore labels when provisioning
Do not attempt to set any test environments as active based on user-supplied labels when tox will provision a new environment and re-execute itself. If any labeled environments depend on a future tox version or external plugin, their configuration will be invalid and thus cannot be set active. fix #2916
1 parent b26a1b9 commit 386dad4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/changelog/2916.bugfix.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Ignore labels when tox will provision a runtime environment (``.tox``) so that environment configurations which depend
2+
on provisioned plugins or specific tox versions are not accessed in the outer tox process where the configuration would
3+
be invalid - by :user:`masenf`.

src/tox/session/env_select.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ def _mark_active(self) -> None:
315315
if labels or factors:
316316
for env_info in self._defined_envs_.values():
317317
env_info.is_active = False # if any was selected reset
318-
if labels:
318+
# ignore labels when provisioning will occur
319+
if labels and (self._provision is None or not self._provision[0]):
319320
for label in labels:
320321
for env_name in self._state.conf.core["labels"].get(label, []):
321322
self._defined_envs_[env_name].is_active = True

0 commit comments

Comments
 (0)