-
- Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: add warning when pytest.ini and pyproject.toml are present #13797
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
feat: add warning when pytest.ini and pyproject.toml are present #13797
Conversation
caf5ef7
to fce5184
Compare The behaviour does not change however users will be notified that pytest.ini is selected over pyproject.toml and any configuration related to pytest it may contain.
fce5184
to 5ff1af4
Compare I am unsure what to do to satisfy codecov. Any hint would be appreciated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this.
I haven't thought yet whether we really want this, but in any case a couple of comments:
We should not emit a warning if pyproject.toml
exists but without a pytest section. That's very common and expected and not ambiguous (please also add a test for this case).
Also, it will be better not to have the "should warn" logic in terminal.py, it shouldn't know about config stuff itself. Ideally (I think) the core config file search logic should indicate whether need to warn.
Doing so, Terminal does not need to know anything about the configuration files.
@bluetech I should have kept my original implementation which was following your suggestion minus the verification of the content of the I refactored the code following your suggestion. |
Do it the other way around, check if the file suffix is ini rather than listing the possible names.
This will let users know exactly which files have been ignored in case multiple of them contain pytest configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Now the approach looks good to me, though I haven't reviewed the code in detail.
@nicoddemus I'll leave it to you to decide whether we want this :)
I think so, because having both configurations is confusing and error prone -- a warning would be welcome. I will try to review this in the next few days, thanks folks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sgaist!
Left a few minor comments, please take a look!
- Improved data type - Fixed multiple docstring - Cleaned up remainder config file check loop Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feebacks and suggestions !
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a warning when pytest.ini and pyproject.toml are present
The behaviour does not change however users will be notified that pytest.ini is selected over pyproject.toml and any configuration related to pytest it may contain.
Fixes #13330