-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py] Fix pytest_ignore_collect hook to respect --ignore #15787
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
Conversation
Fix the `pytest_ignore_collect` hook to respect `--ignore` specified by the user. Returning `False` stops pytest from consulting additional hooks, including its default hooks that are necessary to process `--ignore` option. By returning `True` or `None`, the hook combines files ignored by default with ignores specified by the user.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
cgoldberg
left a comment
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.
@mgorny this looks fine, but can you give an example of how this was broken before? (just so I understand the change better)
|
For example, if you run: Without the patch, |
|
The failure in CI is unrelated to this change. |
cgoldberg
left a comment
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.
got it. thanks for the contribution!
|
Thanks! |
User description
🔗 Related Issues
💥 What does this PR do?
Fix the
pytest_ignore_collecthook to respect--ignorespecified by the user.🔧 Implementation Notes
Returning
Falsestops pytest from consulting additional hooks, including its default hooks that are necessary to process--ignoreoption. By returningTrueorNone, the hook combines files ignored by default with ignores specified by the user.💡 Additional Considerations
This is a pure test change.
🔄 Types of changes
PR Type
Bug fix, Tests
Description
Fixes
pytest_ignore_collectto respect--ignoreoptionEnsures default pytest ignores are combined with custom ignores
Prevents premature stopping of hook processing
Changes walkthrough 📝
conftest.py
Fix test collection ignore logic for pytestpy/conftest.py
pytest_ignore_collectto returnTrueorNoneinstead ofFalse--ignoreoption