pytest should be overriding the interpreter's default warnings filter
See original GitHub issueWhen DeprecationWarning was hidden by default, the expectation was that 3rd party test runners would follow the unittest
module’s lead and re-enable them when running tests (see https://docs.python.org/3/whatsnew/2.7.html#changes-to-the-handling-of-deprecation-warnings and and https://docs.python.org/3/library/unittest.html#unittest.TextTestRunner)
This currently isn’t the case for pytest - it requires developers to explicitly opt-in to seeing deprecation warnings, rather than requiring them to opt-out the way unittest does.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:6 (5 by maintainers)
Top Results From Across the Web
warnings — Warning control — Python 3.11.1 documentation
Default Warning Filter By default, Python installs several warning filters, which can be overridden by the -W command-line option, the PYTHONWARNINGS ...
Read more >How to capture warnings — pytest documentation
By default pytest will display DeprecationWarning and PendingDeprecationWarning warnings from user code and third-party libraries, as recommended by PEP 565.
Read more >python - How to suppress a third-party warning using ...
Easiest way would be as the warnings module suggests here: with warnings.catch_warnings(): warnings.simplefilter("ignore") import paramiko.
Read more >pytest Documentation - Read the Docs
By default, pytest will not show test durations that are too small (<0.005s) ... filterwarnings - filter certain warnings of a test function....
Read more >Who should see Python deprecation warnings? - LWN.net
The Python interpreter can generate quite a few warnings in various ... always been filtered, DeprecationWarning was visible by default until the Python...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closed by #3931
Thanks @ncoghlan for the feedback!
Our intention is to do that when we refactor the warnings system. We had a few discussions about this but I can’t find them in the issue tracker right now, I will see if I can find them tomorrow.