Skip to content

Commit

Permalink
env_select: ignore labels when provisioning
Browse files Browse the repository at this point in the history
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
  • Loading branch information
masenf committed Feb 8, 2023
1 parent b26a1b9 commit 386dad4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/changelog/2916.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ignore labels when tox will provision a runtime environment (``.tox``) so that environment configurations which depend
on provisioned plugins or specific tox versions are not accessed in the outer tox process where the configuration would
be invalid - by :user:`masenf`.
3 changes: 2 additions & 1 deletion src/tox/session/env_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ def _mark_active(self) -> None:
if labels or factors:
for env_info in self._defined_envs_.values():
env_info.is_active = False # if any was selected reset
if labels:
# ignore labels when provisioning will occur
if labels and (self._provision is None or not self._provision[0]):
for label in labels:
for env_name in self._state.conf.core["labels"].get(label, []):
self._defined_envs_[env_name].is_active = True
Expand Down

0 comments on commit 386dad4

Please sign in to comment.