🐛 fix(config): support base inherit in TOML format#3754
Merged
gaborbernat merged 1 commit intotox-dev:mainfrom Feb 18, 2026
Merged
🐛 fix(config): support base inherit in TOML format#3754gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat merged 1 commit intotox-dev:mainfrom
Conversation
The `base` configuration key for inheriting from arbitrary testenv sections worked in INI format but silently failed in TOML. This was because the TOML source only looked up base sections at the core level (e.g. top-level `py_base` key), missing sections nested under the `env` table where environments are actually defined. Aligned TOML with INI behavior by also yielding a section using the current section's prefix, so `base = ["shared"]` in `[env.a]` now correctly resolves `[env.shared]`. Fixes tox-dev#3497
a7443c3 to
8104aad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
baseconfiguration key allows environments to inherit settings from arbitrary sections, which is useful for sharing configuration across multiple environments without repeating it. This worked correctly in INI format (e.g.base = py_basein[testenv:py3.11]resolving[testenv:py_base]) but silently failed in TOML format —base = ["shared"]in[env.a]would not find[env.shared]. 🔍The INI source already handled this by looking up base entries at both the explicit level and within the current section's prefix (e.g.
testenv). The TOML source was missing this second lookup, only searching at the top level where environment sections don't live. The fix aligns TOML with INI by also yielding a section scoped to the current prefix, sobase = ["shared"]correctly resolves against[env.shared]in bothtox.tomlandpyproject.toml.This is a pure bugfix — existing configurations that don't use
basein TOML are unaffected. Users who previously worked around this limitation by duplicating configuration across TOML environment sections can now usebaseas intended.Fixes #3497