-
-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partial match on testenv results in use of base testenv #3219
Comments
To determine whether we have been given a valid *env*, we compare the *factors* of the *env* to our known set of *factors*. If a testenv contains a series of valid factors, we assume the testenv is valid. This is an incorrect assumption: a testenv is only valid if it defined in the configuration file *or* is one of the "special" auto-generated testenvs like e.g. 'py310'. Correct this mistake. Signed-off-by: Stephen Finucane <[email protected]> Closes: tox-dev#3219
To determine whether we have been given a valid *env*, we compare the *factors* of the *env* to our known set of *factors*. If a testenv contains a series of valid factors, we assume the testenv is valid. This is an incorrect assumption: a testenv is only valid if it defined in the configuration file *or* is one of the "special" auto-generated testenvs like e.g. 'py310'. Correct this mistake. While we're here, we make use of verbose mode to explain our regex for matching "magic" factors better. Signed-off-by: Stephen Finucane <[email protected]> Closes: tox-dev#3219
I'd like to know what is the expected behaviours in the below: [testenv]
skip_install = true
allowlist_externals =
echo
commands =
foo: echo "foo"
bar: echo "bar"
baz: echo "baz"
fizz-buzz: echo "fizz-buzz"
[testenv:foo-bar]
commands =
echo "foo-bar"
[testenv:fizz-buzz]
commands =
echo "basic sparkle"
[testenv:fizz-buzz-bang]
commands =
echo "extra sparkle" tox -e foo
tox -e bar
tox -e foo-bar
tox -e bar-foo
tox -e foo-bar-baz
tox -e fizz
tox -e fizz-buzz
tox -e fizz-buzz-bang
tox -e fizz-bang-buzz |
|
Okay, that broadly aligns with what I'd expect. So I think the issue here is that we're equating a factor to be both a thing defined inside e.g.
We then have the following factors:
This results in a large matrix of dynamic testenvs:
So the crucial bit here that we probably don't consider |
To be clear, this is only for determining whether a provided testenv in valid or not. Obviously a user could do the following: [testenv:fizz-buzz{,-bang}]
commands =
!bang: echo "basic sparkle"
bang: echo "extra sparkle" So |
* Update openstacksdk from branch 'master' to 568921ce5b50275061c5dd0ba7180842f3c157a7 - tox: Correct functional test factors We are running functional tests in zuul without a 'pyNN' factor (e.g. 'tox -e functional'). For this to work, we need to allow an empty factor, i.e. we want: [testenv:functional{,-py310}] rather than: [testenv:functional{-py310}] (note the missing comma) Unfortunately we missed this as tox 4 has a currently unaddressed regression [1] that results in it running the base testenv in the case there is only a partial factor match. That needs to be fixed for avoid this biting us again the future, but we can at least fix it for now. [1] tox-dev/tox#3219 Change-Id: Ib9f65a4523222f1224d51534c5061f90501b59d3 Signed-off-by: Stephen Finucane <[email protected]>
We are running functional tests in zuul without a 'pyNN' factor (e.g. 'tox -e functional'). For this to work, we need to allow an empty factor, i.e. we want: [testenv:functional{,-py310}] rather than: [testenv:functional{-py310}] (note the missing comma) Unfortunately we missed this as tox 4 has a currently unaddressed regression [1] that results in it running the base testenv in the case there is only a partial factor match. That needs to be fixed for avoid this biting us again the future, but we can at least fix it for now. [1] tox-dev/tox#3219 Change-Id: Ib9f65a4523222f1224d51534c5061f90501b59d3 Signed-off-by: Stephen Finucane <[email protected]>
Without this comma, tox runs the standard testenv instead of this one. This is due to how tox calculates factors (parts of a testenv name) and checks for their existence [1]. [1] tox-dev/tox#3219 Change-Id: I3fc33a26b0d7f057d7bd6a094fc2ceeaa88f177b Signed-off-by: Stephen Finucane <[email protected]>
* Update openstacksdk from branch 'master' to c2470a21de72969812642ed4acf1c7c49b45dd6e - tox: Fix functional tests Without this comma, tox runs the standard testenv instead of this one. This is due to how tox calculates factors (parts of a testenv name) and checks for their existence [1]. [1] tox-dev/tox#3219 Change-Id: I3fc33a26b0d7f057d7bd6a094fc2ceeaa88f177b Signed-off-by: Stephen Finucane <[email protected]>
Issue
Consider the following toy
tox.ini
:This should result in a single testenv
functional-py310
(there's only one factor) plus the defaultpyNN
testenvs. Attempts to use a testenv with thefunctional
factor but a differentpyNN
factor (e.g.tox -e functional-py312
) or without apyNN
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:
Once we switch to tox 4, this is no longer the case:
Totally undefined envs fail as expected (though with an uglier error than previously):
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.
The text was updated successfully, but these errors were encountered: