Skip to content

fix: apply testenv overrides to TOML env templates#3886

Closed
gaborbernat wants to merge 2 commits intotox-dev:mainfrom
gaborbernat:3860
Closed

fix: apply testenv overrides to TOML env templates#3886
gaborbernat wants to merge 2 commits intotox-dev:mainfrom
gaborbernat:3860

Conversation

@gaborbernat
Copy link
Member

Fixes #3860

Summary

  • When using TOX_OVERRIDE with testenv prefix (e.g., testenv.pass_env+=VAR), overrides were not applied to TOML configurations
  • TOML uses different section names (env_run_base, tool.tox.env) than INI (testenv)
  • The loader only looked up overrides by exact section key match
  • Now check for "testenv" namespace in override_map and apply those overrides to TOML env templates

Changes

  • Updated toml_pyproject.py to map testenv overrides to TOML env sections
  • Updated ini.py to also check section prefix for overrides
  • Added tests for override behavior with custom variables

Test Plan

  • Added test test_tox_override_pass_env_custom_var to verify custom variables work with TOX_OVERRIDE
  • All existing override tests pass
  • Test validates both config display and runtime behavior

When using TOX_OVERRIDE with testenv prefix (e.g.,
`testenv.pass_env+=VAR`), overrides were not applied to TOML
configurations because TOML uses different section names (env_run_base,
tool.tox.env) than INI (testenv). The loader only looked up overrides
by exact section key match.

Now check for "testenv" namespace in override_map and apply those
overrides to TOML env templates (env_run_base) and env-prefixed
sections. This allows users to use the same override syntax across both
INI and TOML config formats.

Fixes tox-dev#3860
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TOX_OVERRIDE for pass_env shows in config but doesn't actually pass env vars

1 participant