Skip to content
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

tox should crash when an unknown key is used #1121

Closed
obestwalter opened this issue Jan 5, 2019 · 6 comments
Closed

tox should crash when an unknown key is used #1121

obestwalter opened this issue Jan 5, 2019 · 6 comments
Labels

Comments

@obestwalter
Copy link
Member

If the user mistypes a key name, they should get appropriate feedback that what they might want to happen will not happen.

One obvious example:

[testenv]
deps = pytest
command = pytest

oops - forget the s and the tests are not run.

Error could look something like:

ERROR: unknown key 'command' in testenv 'whatever'

On first look this seems an easy fix. One thing that needs to be kept in mind is that plugins can also add configuration options, so the check needs to happen after the plugins had the chance to do that.

Also: I sincerely hope that nobody uses the existing behaviour to add their own keys to tox testenvs and do something with them in a different tool, but even if it is I would regard this a breaking change triggering major version jump.

@obestwalter obestwalter added feature:new something does not exist yet, but should level:easy rought estimate that this might be quite easy to implement labels Jan 5, 2019
@gaborbernat
Copy link
Member

I'm opposed to this myself, for multiple reasons, I think this would cause lots of issues:

  • some of the keys might be there for some optional plugins (aka virtual env no download - without the plugin the process should finish just as fine, why would we force users to install the plugin if it's optional - definitely not until we have plugin auto provision implemented),
  • this would be breaking change and not bound well with the current substitution logic possibilities ( I use this technique myself multiple times):
[tox]
magic_dep = a

[tox:A]
deps = {[tox]magic_dep}
       d
[tox:B]
deps = {[tox]magic_dep}
       c 

@gaborbernat gaborbernat added type:question ❔ a question about how things work or if something is a bug or a feature and removed feature:new something does not exist yet, but should level:easy rought estimate that this might be quite easy to implement labels Jan 5, 2019
@gaborbernat
Copy link
Member

To be fair I don't even think we have a reliable way to find out what option is needed and what's not. We load all in the file (the defined one are post-processed), but some of them might only be accessed by downstream plugins and I don't believe they can at the moment even register new file configs. At minimum we would be looking at a long migration path until the plugins would adopt. I don't think it's worth the effort, so I'll close this unless someone can convince me otherwise by tomorrow.

@obestwalter
Copy link
Member Author

I think you misunderstand the issue: It's not about not needed keys, it's about unknown keys. If plugins do not make their keys known in a well defined way yet than this would be something that could be improved.

@obestwalter obestwalter added needs:discussion It's not quite clear if and how this should be done and removed type:question ❔ a question about how things work or if something is a bug or a feature labels Jan 5, 2019
@obestwalter
Copy link
Member Author

But you're right: self defined substitutions would need to be handled also. I don't know if it's worth the effort, but we should at least discuss it.

If there is no general solutions, we could maybe catch the most common mistakes, but that would be ugly.

If there is no programmatic solution for this then it should be documented clearly that the user can define arbitrary keys and reuse them later, because AFAIK this is not explicitly documented.

@gaborbernat
Copy link
Member

there's no way to 100% classify what's unneeded and what's unknown AFAIK, so I don't think it's doable. yes we should document the substitution part.

@obestwalter
Copy link
Member Author

there's no way to 100% classify what's unneeded and what's unknown AFAIK, so I don't think it's doable.

Looking at it again, I am afraid you're right. There is no clean way to do this. I guess it is better to come around to the idea that the way how configuration with tox.ini works is what it is and it is good enough although it has quite a few qualities which make it less newbie friendly and harder to debug problems.

Rather than trying to fix it here, we can learn from this and let this flow into the design of #999.

If we can agree on this, maybe we should even announce (and add to the (contributor) docs) that new features or major changes in tox.ini are not wanted and it is considered frozen (except for bug fixes). Then we can concentrate on making it better with the new config format.

Closing this then and opening issues for what came up here, as it is off-topic here.

@obestwalter obestwalter added wontfix and removed needs:discussion It's not quite clear if and how this should be done labels Jan 6, 2019
@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants