-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add docs on pytest.warns(None) deprecation #9495
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
nicoddemus
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.
Thanks @olgarithms!
Still a few last minutes adjustments left to do, please take a look. 👍
| with warnings.catch_warnings(): | ||
| warnings.simplefilter("ignore") | ||
| Recording warnings |
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.
| Recording warnings | |
| .. _recwarn: | |
| Recording warnings |
|
|
||
| .. _`recording warnings`: | ||
|
|
||
| .. _recwarn: |
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 is a cross-reference label referring to the Recording warnings section, so it should be kept close to it.
We should also create a new cross reference label here that can be used instead of the full URL in the changelog:
| .. _recwarn: | |
| .. _warns-use-cases: |
doc/en/deprecations.rst
Outdated
| Its correct usage was checking that the code emits at least one warning of any type - like ``pytest.warns()`` | ||
| or ``pytest.warns(Warning)``. | ||
|
|
||
| See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for use cases. |
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.
| See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for use cases. | |
| See :ref:`warns-use-cases` for examples. |
nicoddemus
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.
Thanks @olgarithms!
|
Thanks @olgarithms! This is a really nice solution for a very long discussion thread 💖 |
|
Thank you all for your guidance and making this far less intimidating than it was! |
Closes #9404.
I added more context on the deprecation doc, but I have been wondering whether it would be useful to have these example on the main doc of
pytest.warns(), as people might not reach the first one.Thoughts?