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
Multiple -e options behave differently in tox 4.x vs tox 3.x #3199
Comments
I've run into this multiple times in different projects, and it always trips me up. (I'm currently working on the same project as @rhertzog and suggested that he file this issue.) |
v4 was a huge multi-year rewrite with a lot of breaking changes. I'm pretty sure most are expected. Probably worth mentioning @ https://tox.wiki/en/4.12.1/upgrading.html#updating-usage-with-e though. |
I can confirm that this has changed. To me it looks like a regression and I see no obvious reason why we should not re-introduce it for tox 4. |
A PR fixing this would be accepted. |
I've not dug into the old v3 code, but I'm assuming that it did something along the lines of The current code I suppose introduced the The issue here is that with the argument value being a single argparse doesn't offer any way to have a We can't use a list of str here because The first idea I had was to change the value of We also need need to preserve the behaviour where the default is replaced by any Unfortunately, testing shows this won't work for a default that's a But this does give us a workaround, I think: we can make That may be a bit hacky, but the other approach I can think of involves doing extra processing external to Anyway, if my idea of mutable |
I'm fine with this; however, I'd like to disable mutating CliEnv ideally post config session 🤔 |
Yeah, I thought about disabling mutations of CliEnv, but decided that the extra complexity is not worth it. This complexity comes in two areas: first, it makes the class itself more complex because we need further state to determine whether the mutation methods are allowed to be called or not. Second, it adds extra complexity to the clients of the class because they must toggle this state at the appropriate time. And worse yet for the second one, that involves tracking down all the uses of the class and modifying and testing them. Given that in the new arrangement I suggested above a Speaking of, "when in doubt, keep things simple," it also seems to me that |
There's value in keeping the CLI and str parser in sync. Furthermore any kind of backward incompatible change here is out of the question for me personally. Newlines are possible in the CLI, e.g. -e 'a\nb' is valid and supported and I have other examples too. It's not just,. We have a finalize config for this reason, it should be not difficult to do. |
For the I don't see the value in having It could well be that there's subtle behaviour in there that I'm missing. If so, can you write a test that exposes that, so we know what it is and that it won't get broken? |
I notice that specifying zero-length environment names to the |
@gaborbernat Regarding the formatting of test vectors, I find a lists of these considerably easier to read when they're nicely lined up in columns:
However,
Is the latter really what you want? |
I just noticed your edit to add this. What is the "finalize config" and how does it work? |
Yes 🤷♂️ this is one of those few cases where for me consistency trumps the benefits. |
Ok, the squished formatting it is. Still waiting for answers on the other, more important questions, particularly the zero-length envname one. |
I don't have a strong feeling about that. I feel like raising an error, not running anything or considering it as use the default values all the same equally right. |
Ok. I think that raising an error is the best course: if the user's intent isn't clear, this asks him to clarify it. I expect the most likely reason for the user supplying something that looks like it has zero-length envnames is that he forgot to finish what he was typing (or just seriously misunderstands what he's doing). I've just confirmed that argparse for |
@gaborbernat Where should one put a test that can check |
Up to you 👍 |
Issue
tox -e env1 -e env2
runs the two environments in tox 3.x but runs only env2 in tox 4.x.I don't know if that change is intentional but it's sure to break quite a few CI that rely on
-e
being additive rather than overriding a former value. I would suggest to either fix the behaviour to be consistent with 3.x or put some strong warning in the changelog and documentation that one needs to use the comma separated syntax:tox -e env1,env2
Environment
Provide at least:
Thank you for maintaining tox! It's a great tool.
The text was updated successfully, but these errors were encountered: