R. David Murray added the comment: The easy answer for unittest is to use assertWarns. For versions where that doesn't exist you could implement the same technique yourself. Exposing a 'clear everything' function in the warnings module might not be a bad idea, but otherwise for doctest I'd think the catch_warnings context manager would be the correct answer, and that is documented.
Given the above, I guess this issue is a request to expose a "clear everything" function in the warnings module, which I think is a reasonable idea. (I think it would be nice to add some support stuff to doctest to make things like this easier, but that is a totally separate issue.) ---------- nosy: +brett.cannon, r.david.murray versions: +Python 3.5 -Python 2.7, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20131> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com