[New-bugs-announce] [issue10535] Enable warnings by default in unittest

Ezio Melotti report at bugs.python.org
Thu Nov 25 23:08:36 CET 2010


New submission from Ezio Melotti <ezio.melotti at gmail.com>:

Warnings should be on by default in unittest so that developers can see them while running the tests even if they are silenced by default in Python.

The plan is to add a "warnings" argument to TestProgram and the default TextTestRunner:
  * if the argument is passed always use it as a filter (e.g. default, ignore, all, ...) for warnings;
  * if the argument is not passed and sys.warnoptions is not [] (i.e. python has been called with "-W something") don't do anything (i.e. use the warnings specified by -W);
  * if the argument is not passed and sys.warnoptions is [], use 'default' (i.e. show warnings).

In order to prevent floods of warnings when the deprecated assertEquals, assert_, etc. are used (see #9424), a new type of warning could be created (e.g. _UnittestDeprecationWarning) and filtered so that these warnings are printed only once.

----------
assignee: ezio.melotti
messages: 122411
nosy: brett.cannon, ezio.melotti, michael.foord
priority: normal
severity: normal
stage: needs patch
status: open
title: Enable warnings by default in unittest
type: feature request

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


More information about the New-bugs-announce mailing list