On Wed, Jul 7, 2010 at 9:59 AM, Tres Seaver <tsea...@palladion.com> wrote:
>> Individual test modules can do this, but I'm uncomfortable having a
>> test script make a global setting like this and the warning module
>> doesn't seem to provide a way to capture the current state so it can
>> be reset after running tests.
> As of Python 2.6, the warnings module sports a context manager::
>  with warnings.catch_warnings():
>    warnings.simplefilter("default")
>    fxn()

Ah, this works because catch_warnings saves and later restores the
filter configuration. Cool.


Jim Fulton
Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to