Skip to content

Commit 851f47c

Browse files
EliahKaganclaude
andcommitted
build(tox): skip missing interpreters locally, but not in CI
The README says that running `tox` locally "skips any Python versions you don't have installed". That was tox's default until tox 4.56.0 changed the default of `skip_missing_interpreters` to false. Since then, an environment whose Python is not installed fails. `env_list` names `py38` through `py315`, so a contributor who runs `tox` without all eight versions gets a failed run. Set `skip_missing_interpreters = true` in `[tool.tox]`, so local runs skip those environments again, as the README describes. tox still reports failure if every environment it was asked to run is skipped. The `tox` workflow must not skip, since each job exists to test one Python version. With current tox, it already failed on a missing interpreter, but only because it installs the newest tox. Pass `--skip-missing-interpreters=false` there, so a job fails if its Python is missing, whatever the configuration or tox version says. The option's value is optional, and a bare `--skip-missing-interpreters` means `true`, so the `=` form makes clear that `false` is its value. Checked with tox 4.67.1, with Python 3.9 installed and 3.10 not. `tox -e py39,py310` ran `py39` and skipped `py310`, and passed. With `--skip-missing-interpreters=false`, `py310` failed, and so did the run, also with tox 4.22.0. In a minimal project with the same setting and tox-gh active, a job whose mapped environment had no interpreter failed with that option. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent df93768 commit 851f47c

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎.github/workflows/tox.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ jobs:
8888
8989
- name: Run tox
9090
run: |
91-
python3.13 -m tox
91+
# Fail, rather than skip, if an environment's Python is missing.
92+
python3.13 -m tox --skip-missing-interpreters=false
9293
env:
9394
# tox-gh selects the environments mapped to this version in `[tool.tox.gh.python]`.
9495
TOX_GH_MAJOR_MINOR: ${{ matrix.python-version }}

‎pyproject.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ lint.unfixable = [
158158

159159
[tool.tox]
160160
requires = ["tox>=4.22"]
161+
# Skip environments whose Python is not installed. The `tox` workflow overrides this.
162+
skip_missing_interpreters = true
161163
env_list = [
162164
"py38",
163165
"py39",

0 commit comments

Comments
 (0)