Eli Collins added the comment: I'm not sure how generally applicable this is, but it might be useful as a starting point: Attached is a bit of code I've been using: it's a reset_warnings_registry() context manager, which backs up & clears the registry state for the duration of the context, then restores it afterwards.
It's particularly useful for unittests, just create & call the __enter__() method during setUp(), and attach __exit__() via addCleanup. Each test is then gets it's own isolated warnings registry. ---------- nosy: +eli.collins Added file: http://bugs.python.org/file40031/reset_warning_registry.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21724> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com