Skip to content

tox config -e pyXX gives useless results if XX is invalid #3649

@stephenfin

Description

@stephenfin

Issue

(note: Consider this very low-priority or even closeable. I'm mainly reporting it so there's a record of the behavior somewhere)

Contrast:

❯ tox -e py47 run
py47: skipped because could not find python interpreter with spec(s): py47
  py47: SKIP (0.00 seconds)
  evaluation failed :( (0.24 seconds)

❯ echo $?
255

With:

❯ tox -e py47 config
[testenv:py47]
type = VirtualEnvRunner
...
{snipped}
...
env_site_packages_dir = # Exception: RuntimeError("failed to find interpreter for Builtin discover of python_spec='py47'")
env_bin_dir = # Exception: RuntimeError("failed to find interpreter for Builtin discover of python_spec='py47'")
env_python = # Exception: RuntimeError("failed to find interpreter for Builtin discover of python_spec='py47'")
py_dot_ver = # Exception: Skip('could not find python interpreter with spec(s): py47')
py_impl = # Exception: Skip('could not find python interpreter with spec(s): py47')
py_free_threaded = # Exception: Skip('could not find python interpreter with spec(s): py47')
...
{snipped}
...
wheel_build_env = # Exception: Skip('could not find python interpreter with spec(s): py47')

❯ echo $?
0

I suspect we want the latter to at least return an error code. This happens if py isn't part of any factor:

❯ tox -e foobar config
ROOT: HandledError| provided environments not found in configuration file:
foobar

❯ echo $?
254

Environment

Irrelevant.

Output of running tox

❯ tox --version
4.32.0 from /usr/lib/python3.14/site-packages/tox/__init__.py

Minimal example

See above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions