[Python-Dev] Py3k DeprecationWarning in stdlib

Nick Coghlan ncoghlan at gmail.com
Thu Jun 26 15:56:23 CEST 2008


Andrew Bennetts wrote:
> Brett Cannon wrote:
>> On Wed, Jun 25, 2008 at 6:08 AM, Andrew Bennetts
> [...]
>>> Should I file a bug for this?
>>>
>> If you want, but Benjamin plans to undocument this for users along
>> with all other test.support stuff (which I agree with). Most of the
>> APIs in test.support were just quickly written and have not
>> necessarily been thought through in order to make sure that the APIs
>> makes sense (like in this case).
> 
> Ok, then we're back to there being no supported way to write tests that need to
> intercept warnings.  Twisted has already suffered from this (JP reports that
> Twisted's assertWarns is broken in 2.6), and I doubt it's alone.
> 
> So I guess I am filing a bug after all... :)

Yeah - Brett's correct that everything under "test.test_support" should 
really be formally undocumented. It's mostly a place for code that 
reflects "things we do a lot in our unit tests and are tired of 
repeating" rather than "this is a good API that we want to support 
forever and encourage other people to use".

However, if other folks turn out to have similar needs, then it may be 
possible to add something to unittest to support it. However, given that 
the beta deadline has already passed, you may need to use similar 
hackery to that used by catch_warning and replace warnings.showwarning 
with a test function that saves the raised exception (it also wouldn't 
be hard to enhance it a bit to handle more than a single warning).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list