[Python-Dev] Re-enable warnings in regrtest and/or unittest

Nick Coghlan ncoghlan at gmail.com
Tue Nov 23 15:03:53 CET 2010


On Tue, Nov 23, 2010 at 8:01 AM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
> On 22/11/2010 21:08, Guido van Rossum wrote:
>>
>> On Mon, Nov 22, 2010 at 11:24 AM, Brett Cannon<brett at python.org>  wrote:
>>>
>>> The problem with that is it means developers who switch to Python 3.2
>>> or whatever are suddenly going to have their tests fail until they
>>> update their code to turn the warnings off.
>>
>> That sounds like a feature to me... :-)
>>
> I think Ezio was suggesting just turning warnings on by default when
> unittest is run, not turning them into errors. Ezio is suggesting that
> developers could explicitly turn warnings off again, but when you use the
> default test runner warnings would be shown. His logic is that warnings are
> for developers, and so are tests...

Having at least the default test runner change the default warnings
behaviour to -Wd (while still respecting sys.warnoptions) sounds like
a good idea. That way users won't see the warnings (as intended with
that change), but developers are less likely to get nasty surprises
when things break in future releases (which was one of our major
concerns when we made the decision to change the default handling of
DeprecationWarning). A similar change may be appropriate for doctest
as well.

Printing out the list of suppressed warnings in verbose mode may also be useful.

A blanket -We is unlikely to work for the test suite, since generating
warnings on some platforms is expected behaviour (e.g. due to the
ongoing argument between multiprocessing and FreeBSD as to the
appropriate behaviour of semaphores). However, we may be able to get
to the point where it is run that way by default and then affected
tests use check_warnings() to alter the filter configuration
(something that many such affected tests already do).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list