-
-
Notifications
You must be signed in to change notification settings - Fork 527
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
tox4: Factor conditions are not considered for commands
#2002
Comments
The problem does not seem to be the continuation line, but that factors are not considered at all. I get the same error with:
(I just changed py34 to py36 as I do not have py34 installed) |
commands
This looks like a good place to apply action depending on the given factor(s), as here both the tox/src/tox/session/cmd/run/single.py Lines 82 to 104 in 5118401
I'd prefer above spot over the command parsing/creation as we would have to pass in the env additionally. Ok, then we have to search the cmd arg list for factor conditions - looks like the colon at the end is the marker for them. When we find one, in case of a range, we need to split the factors, and then we need to decide if the following args need to be excluded or included. Oh my.. I just read about factor groups 😳 Are factor groups a thing for commands? We have already a factor.py with some helper methods, but I understood this one is used mainly to generate virtualenvs. From the current tox3 documenation:
Is this true? or should this be a range and include py35? And last question... this affects What's your take, @gaborbernat? |
Oh, no. Definitely not there. factor.py is not a helper method module, is the actual factor filtering module. All filtering needs to happen here https://github.com/tox-dev/tox/blob/rewrite/src/tox/config/loader/ini/__init__.py#L42-L46. |
It's not range based, just simple factor match.
No, because the factor filtering is an orthogonal feature to the config value manifestation to Python world. There's no need to develop anything new here, just need to understand why the filtering is not happening within the lines I've linked above (hence why is a bug ticket). |
This will be interesting, as at this stage we do not have a list of command args... not even a knowledge of a thing a like a command... Ok, so it has to happen here... tox/src/tox/config/loader/ini/factor.py Lines 9 to 23 in 5118401
And the return value needs to be the command updated to reflect the current env (name). e.g. given the following tox snippet...
for a py39 env we expect...
for a py35 env we expect...
|
Why do you need command args? You only need the env name to see if matches. |
I head a fresh look on this and the reason why this does not work yet is, that the regex only looks for factor conditions at the very beginning, not in the middle of a line. @gaborbernat I found no answer in the current docs how many factor conditions we support per line... Is it enough to support
or do we need to support (this contrived example)
? |
I don't follow, can you explain differently? |
The current code only supports factor conditions at the beginning of a line:
Is it sufficient to support one factor condition per e.g. command line in a tox ini like this?
Or do we have to support multiple factor conditions per line, something like
|
We match at the beginning of the line only, once; however the factor filtering should happen before the line collapsing, so in your case if the user wrote:
then all should be good. I belive this should be the case here. So here the bug might be that line 33 https://github.com/tox-dev/tox/blob/5118401e6b/src/tox/config/loader/ini/__init__.py#L33 needs to move to line 46 🤔 and all should be as planned. |
Due to the order how the configuration got loaded, and due to a bug in the factor parser, factors were not identified and thus not evaluated in `command` keys. This has been fixed now. Closes #2002
Due to the order how the configuration got loaded, and due to a bug in the factor parser, factors were not identified and thus not evaluated for `command` keys. This has been fixed now. Closes #2002
Due to the order how the configuration got processed, factors were not identified and thus not evaluated for `command` keys. This has been fixed now. Closes #2002
#1590) - Simplify conditional specification of commands in tox configurations (based on the trick mentioned in tox-dev/tox#2002 (comment)) and homogenize factor matrices across different github workflows. - Add `pytest-custom-exit-code` plugin to ignore errors when no tests are collected in a pytest run (useful when using filters). Check pytest documentation about exit codes (https://docs.pytest.org/en/stable/reference/exit-codes.html) for more details. - Update outdated links in the CI development documentation. --------- Co-authored-by: Hannes Vogt <hannes@havogt.de>
Running tox v4 against the following tox.ini currently fails: https://github.com/pypa/virtualenv/blob/0262fa6d9a0f8b45c80e6b2f82109ab1250ec336/tox.ini#L45
It fails with the following error:
Running the same tests with tox v3 works fine.
The text was updated successfully, but these errors were encountered: