[New-bugs-announce] [issue9754] assertWarns and assertWarnsRegexp

Antoine Pitrou report at bugs.python.org
Fri Sep 3 12:50:17 CEST 2010

New submission from Antoine Pitrou <pitrou at free.fr>:

Similar to assertRaises and assertRaisesRegexp, unittest should provide assertWarns and assertWarnsRegexp, to check that a given callable (or piece of code) triggers a particular warning.

Currently, you have to do that manually using a mixture of warnings.catch_warnings and warnings.filterwarnings, which is pretty annoying.

components: Library (Lib)
messages: 115434
nosy: brett.cannon, michael.foord, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: assertWarns and assertWarnsRegexp
type: feature request
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list