-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
fix compatibility for pytest 8 #20575
base: master
Are you sure you want to change the base?
Conversation
with warnings.catch_warnings(): | ||
warnings.simplefilter("error") |
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.
this seems like just a filter, but the original code validates that no warning was raised...
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.
Hi Borda,
According to the doc, the simplefilter("error")
would turn any warning into an error.
So, when a warning occurs, the test would error out.
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.
looks good to me, good use of catch_warnings
to reset behavior back to default outside the context manager
with warnings.catch_warnings(): | ||
warnings.simplefilter("error") |
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.
looks good to me, good use of catch_warnings
to reset behavior back to default outside the context manager
Codecov ReportAll modified and coverable lines are covered by tests ✅
❌ Your project check has failed because the head coverage (49%) is below the target coverage (99%). You can increase the head coverage or adjust the target coverage.
Additional details and impacted files@@ Coverage Diff @@
## master #20575 +/- ##
=========================================
- Coverage 88% 49% -39%
=========================================
Files 267 264 -3
Lines 23380 23324 -56
=========================================
- Hits 20481 11382 -9099
- Misses 2899 11942 +9043 |
What does this PR do?
The test
test_seed_stays_same_with_multiple_seed_everything_calls
is only compatible withpytest==7
, but notpytest==8
due to its passingNone
topytest.warns()
, which is deprecated.This PR fixes the test by making it compatible with both
pytest
7 & 8.more context:
We (Google) uses a monorepo that enforces the pytest version to be 8 for now.
We want to be able to run the unit tests instead of just importing the code.
So, we would like to make this compatibility fix.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Reviewer checklist
📚 Documentation preview 📚: https://pytorch-lightning--20575.org.readthedocs.build/en/20575/