[issue10535] Enable warnings by default in unittest

Ezio Melotti report at bugs.python.org
Fri Nov 26 06:18:28 CET 2010


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

Here's a working patch (without docs and tests).
I managed to filter the warnings by message without introducing a new type of warning. As it is, all the warnings related to deprecated unittest methods are printed only once per module, regardless of what methods are used and how many times.
I'm also thinking that it might be better to include the name of the deprecated method in the message and use three filters for fail* methods, assert* methods, and the assert*Regexp* methods that will be deprecated. This will show at worst 3 warnings per module, but the assert*Regexp* and the fail* methods are not so common, so it shouldn't be too nosy.
One "limitation" of the patch is that the per-module special-casing for unittest is not affect by the `warnings` argument, but it can be changed when -W is used and no `warnings` arg is passed.

Regrtest doesn't seem to use unittest, so it should be fixed separately (probably needs another issue).

----------
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file19821/issue10535.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10535>
_______________________________________


More information about the Python-bugs-list mailing list