Skip to content

Commit

Permalink
Use an instance attribute
Browse files Browse the repository at this point in the history
As far as I can tell, during runtime there's only one EnvSelector
instance, so there's no danger of repeatedly warning about the same
skipped environment when .iter() gets called several times.

Fixes failing unit tests.  (Oops.  I only ran each test in isolation,
because the entire test suite is a bit slow.)
  • Loading branch information
mgedmin authored and gaborbernat committed Dec 15, 2022
1 parent 89572aa commit c13c9db
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tox/session/env_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,14 @@ class _ToxEnvInfo:

class EnvSelector:

_warned_about: set[str] = set() #: shared set of skipped environments that were already warned about
_warned_about: set[str] #: shared set of skipped environments that were already warned about

def __init__(self, state: State) -> None:
# needs core to load the default tox environment list
# to load the package environments of a run environments we need the run environment builder
# to load labels we need core + the run environment
self.on_empty_fallback_py = True
self._warned_about = set()
self._state = state
self._cli_envs: CliEnv | None = getattr(self._state.conf.options, "env", None)
self._defined_envs_: None | dict[str, _ToxEnvInfo] = None
Expand Down

0 comments on commit c13c9db

Please sign in to comment.