From c13c9dbd42a3cfb9c5847b3732e022b829341439 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Wed, 14 Dec 2022 12:00:45 +0200 Subject: [PATCH] Use an instance attribute 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.) --- src/tox/session/env_select.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tox/session/env_select.py b/src/tox/session/env_select.py index 40254c75a..0ed76515d 100644 --- a/src/tox/session/env_select.py +++ b/src/tox/session/env_select.py @@ -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