question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pytest should be overriding the interpreter's default warnings filter

See original GitHub issue

When 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:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nicoddemuscommented, Sep 6, 2018

Closed by #3931

1reaction
nicoddemuscommented, Nov 10, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found