[New-bugs-announce] [issue7849] Improve "test_support.check_warnings()"
report at bugs.python.org
Wed Feb 3 21:02:32 CET 2010
New submission from Florent Xicluna <laxyf at yahoo.fr>:
Currently this context manager is used in 3 different situations:
- to silence standard warnings
- to record warnings in a list, in order to verify them
- to silence py3k warnings
But it does not accept any parameter, and it does not *check* if the filter is obsolete. It silence *all* warnings, blindly.
I would like to propose an enhancement of this function, which accepts a list of filters as parameters, and which verifies that there's really something to catch.
An optional boolean argument "lazy" can be used to disable the check.
check_warnings([filter[, ...[, lazy=False]]])
Additionnally, a sister function will filter only the py3k warnings:
check_py3k_warnings([filter[, ...[, lazy=False]]])
See the patch and its docstring for details.
Note: this context manager could be used to fix the last part of #7092
nosy: ezio.melotti, flox
title: Improve "test_support.check_warnings()"
type: feature request
versions: Python 2.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce