-
Notifications
You must be signed in to change notification settings - Fork 323
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
Introduce catch_warnings fixture #844
Conversation
Should we also add Userwarning into the list of ignores? from pytorch_lightning.utilities.warnings import PossibleUserWarning
warnings.simplefilter("ignore", PossibleUserWarning)
warnings.simplefilter("ignore", UserWarning) |
I'd rather not, since they are too broad, but I can be convinced :D What are some that are giving you a hard time? |
In test cases some examples were:
|
Regarding
|
Also some more warning examples that might not lead to any major error
|
@shivammehta007 I will go by these warnings one by one.
I still stand by not silencing |
Hmm! I think that makes sense thanks! I will try setting stuff and filtering |
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.
Can we pls add also a usage example to the code or/and mention it in https://github.com/Lightning-AI/lightning-bolts/blob/master/.github/CONTRIBUTING.md or create a readme in the tests folder...
Sorry for being late for the party, but there's already an option within pytest that we use in PL: I guess we can still continue to use @otaj's fixture implemented in #844, but eventually, we would want to use the standardized way of handling warnings in our tests :) |
Hi @akihironitta, thank you, I know about that option. However, as far as I know, that doesn't allow you to specify these fixtures on a test by test basis, and we don't want to break our CI 😂. But I fully agree, as soon as everything is using this fixture, we can and should start using the standardized way |
Hi @otaj - I'm getting the following warnings
Which looks like it is related to pytorch/pytorch#69823 and https://stackoverflow.com/questions/71666214/deprecation-warnings-distutils-and-netcdf-file. My
Everything was installed by using the requirements.txt provided in bolts, I'm using Python 3.9.12. This seems like a broader issue than lightning-bolts, how should I deal with this? |
What does this PR do?
Introduces
catch_warnings
pytest fixture, which reviewers can use to check, that no warnings other thanUnderReviewWarning
is emitted during the testBefore submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃