A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-April/023313.html below:

[Python-Dev] DeprecationWarnings in the regression tests

[Python-Dev] DeprecationWarnings in the regression tests [Python-Dev] DeprecationWarnings in the regression testsTim Peters tim.one@comcast.net
Mon, 15 Apr 2002 20:13:42 -0400
Damn.  warnings.resetwarnings() doesn't really

    """Reset the list of warnings filters to its default state."""

if by "its default state" one means (as I do <wink>) its initial state upon
importing the warnings module.

I had the clever idea of calling warnings.resetwarnings() in regrtest.py
after running each test, at least so that the damage done by a sloppy
overly-general warning suppression added by one test couldn't hurt error
reporting in other tests.

But an unwanted side effect is that I'm getting brand new "surprise"
warnings now, because warnings.py does

    filterwarnings("ignore", category=OverflowWarning, append=1)

as part of its initialization, but resetwarnings nukes that.

What should resetwarnings really do?  Offhand it looks most reasonable to me
to move the module initialization code

    _processoptions(sys.warnoptions)
    filterwarnings("ignore", category=OverflowWarning, append=1)

into the body of resetwarnings(), then call the latter from the
initialization block.

Objections?





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4