Skip to content

🐛 fix(config): resolve overrides with alias config keys - #3736

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix-override-alias-keys
Feb 17, 2026
Merged

🐛 fix(config): resolve overrides with alias config keys#3736
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix-override-alias-keys

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Feb 17, 2026

Copy link
Copy Markdown
Member

Many tox configuration keys have aliases for backward compatibility (e.g., pass_env/passenv, set_env/setenv, env_list/envlist). When using TOX_OVERRIDE with the append operator (+=) and the override key name differed from what was used in the config file, tox would silently drop either the config value or the override value. For example, TOX_OVERRIDE=testenv.pass_env+=BAR would lose FOO if the ini file used passenv = FOO, and vice versa. 🐛 This has been a pain point for projects relying on CI-level overrides to extend environment variables.

The root cause was in how config loading iterated over alias keys independently. The loader tried each key name separately with each config source, and would stop on the first key that produced any result — even if that result was only from the override, missing the raw config value stored under the alias. The fix consolidates alias resolution: Loader.load() now receives all alias keys upfront, collects overrides from any of them, and tries loading the raw value from all aliases before applying overrides.

Fixes #3127, fixes #3348.

@gaborbernat gaborbernat changed the title fix(config): resolve overrides with alias config keys 🐛 fix(config): resolve overrides with alias config keys Feb 17, 2026
@gaborbernat
gaborbernat force-pushed the fix-override-alias-keys branch from 9af2967 to fb4df29 Compare February 17, 2026 22:05
When using TOX_OVERRIDE with += (append) and the override key differs
from the config file key (e.g., pass_env vs passenv), the config
value was lost. Now Loader.load() checks all alias keys for both
raw config values and overrides.

Fixes tox-dev#3127, fixes tox-dev#3348.
@gaborbernat
gaborbernat force-pushed the fix-override-alias-keys branch from fb4df29 to cec3722 Compare February 17, 2026 22:07
@gaborbernat
gaborbernat enabled auto-merge (squash) February 17, 2026 22:08
@gaborbernat
gaborbernat merged commit 69c0b42 into tox-dev:main Feb 17, 2026
28 checks passed
@gaborbernat
gaborbernat deleted the fix-override-alias-keys branch February 17, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant