-
-
Notifications
You must be signed in to change notification settings - Fork 539
Description
Issue
Consider the following toy tox.ini
:
[testenv]
skip_install = true
allowlist_externals =
echo
commands =
echo "base testenv"
[testenv:functional{-py310}]
commands =
echo "functional testenv"
This should result in a single testenv functional-py310
(there's only one factor) plus the default pyNN
testenvs. Attempts to use a testenv with the functional
factor but a different pyNN
factor (e.g. tox -e functional-py312
) or without a pyNN
factor (e.g. tox -e functional
) should fail since it doesn't match an env making it no different to e.g. tox -e doesnotexist
.
In tox 3, this was the case:
❯ virtualenv .venv --python=python3.8
❯ source .venv/bin/activate
❯ pip install 'tox<3'
❯ tox -e functional-py310 -q
functional testenv
__________________________________________________________________ summary __________________________________________________________________
functional-py310: commands succeeded
congratulations :)
❯ tox -e functional-py312 -q
ERROR: unknown environment 'functional-py312
❯ tox -e functional -q
ERROR: unknown environment 'functional'
❯ tox -e doesnotexist -q
ERROR: unknown environment 'doesnotexist'
Once we switch to tox 4, this is no longer the case:
❯ tox -e functional-py310 -q
functional testenv
functional-py310: OK (0.22 seconds)
congratulations :) (0.29 seconds)
❯ tox -e functional-py312 -q
base testenv
functional-py312: OK (0.13 seconds)
congratulations :) (0.18 seconds)
❯ tox -e functional -q
base testenv
functional: OK (0.14 seconds)
congratulations :) (0.20 seconds)
Totally undefined envs fail as expected (though with an uglier error than previously):
❯ tox -e doesnotexist -q
ROOT: HandledError| provided environments not found in configuration file:
doesnotexist
This can result in us running a wholly different set of tests/commands if e.g. a user uses a pyNN
factor that is not defined inline or does not use a factor (with the idea being you'd use the Python version tox is installed under).
Environment
Using latest tox 3 and 4 available from pip
(currently 3.28.0 and 4.12.1, respectively).
Minimal example
See above.