diff --git a/docs/changelog/3238.bugfix.rst b/docs/changelog/3238.bugfix.rst new file mode 100644 index 000000000..e4d65a63c --- /dev/null +++ b/docs/changelog/3238.bugfix.rst @@ -0,0 +1 @@ +Fix issue with not expanding placeholders like ``{envtmpdir}`` by :user:`bennyrowland`. diff --git a/src/tox/config/main.py b/src/tox/config/main.py index a409aaa0a..1a7193d38 100644 --- a/src/tox/config/main.py +++ b/src/tox/config/main.py @@ -41,6 +41,7 @@ def __init__( # noqa: PLR0913 self._src = config_source self._key_to_conf_set: dict[tuple[str, str, str], ConfigSet] = OrderedDict() + self._key_to_env_conf: dict[str, EnvConfigSet] = {} self._core_set: CoreConfigSet | None = None self.memory_seed_loaders: defaultdict[str, list[MemoryLoader]] = defaultdict(list) @@ -159,18 +160,21 @@ def get_env( :param loaders: loaders to use for this configuration (only used for creation) :return: the tox environments config """ - section, base_test, base_pkg = self._src.get_tox_env_section(item) - return self.get_section_config( - section, - base=base_pkg if package else base_test, - of_type=EnvConfigSet, - for_env=item, - loaders=loaders, - ) + if item not in self._key_to_env_conf: + section, base_test, base_pkg = self._src.get_tox_env_section(item) + self._key_to_env_conf[item] = self.get_section_config( + section, + base=base_pkg if package else base_test, + of_type=EnvConfigSet, + for_env=item, + loaders=loaders, + ) + return self._key_to_env_conf[item] def clear_env(self, name: str) -> None: section, _, __ = self._src.get_tox_env_section(name) self._key_to_conf_set = {k: v for k, v in self._key_to_conf_set.items() if k[0] == section.key and k[1] == name} + self._key_to_env_conf.pop(name) ___all__ = [