You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Fix install_command ignored from TOML config (#3724)
## Summary
Fixes#3574 — custom `install_command` was silently ignored when
specified in `tox.toml` or `pyproject.toml`, always falling back to the
default pip install command.
### Root cause
Two bugs conspired to produce this behavior:
1. **`get_base_sections` placed base sections under the `env`
namespace.** It used `test_env(b)` which wraps the section name under
`env.*`, but `env_run_base` and `env_pkg_base` are top-level sections —
`[env_run_base]` in `tox.toml` and `[tool.tox.env_run_base]` in
`pyproject.toml`. This caused the loader to navigate to
`env.env_run_base` (which doesn't exist) and return `None`, so no
settings from `env_run_base` were applied.
2. **The TOML replacement engine raised on unknown `{...}`
placeholders.** When `Unroll` processed strings like `{packages}` inside
an `install_command` array, `TomlReplaceLoader` tried to resolve
`packages` as a config key, failed with `KeyError`, and raised — causing
the config loader to fall through to the default. The INI loader's
equivalent (`ReplaceReferenceIni`) returns `None` for unresolvable
references (keeping the original text), matching the documented contract
of `ReplaceReference.__call__`.
### Changes
- **`toml_pyproject.py`**: `get_base_sections` now constructs sections
with the core prefix (or `None`), correctly placing
`env_run_base`/`env_pkg_base` at the top level rather than under `env`.
- **`_replace.py`**: `TomlReplaceLoader.__call__` returns `None`
(instead of raising) when a `KeyError` occurs with no default,
consistent with the INI loader and the `ReplaceReference` protocol.
- **Test**: Parameterized test verifying `install_command` is respected
from both `tox.toml` and `pyproject.toml`.
- **Changelog**: Added `docs/changelog/3574.bugfix.rst`.
### Test plan
- [x] New parameterized test (`tox.toml` and `pyproject.toml` variants)
- [x] All 27 show_config tests pass
- [x] All 143 config/loader/source tests pass
- [x] All 49 pip install tests pass
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
0 commit comments