[Python-ideas] unittest and warnings
Vinay Sajip
vinay_sajip at yahoo.co.uk
Tue Jun 18 15:20:52 CEST 2013
Giampaolo Rodola' <g.rodola at ...> writes:
> Would it make sense for unittest module to keep track of [warnings] so
> that they get included in the final test result as it currently happens
> for skipped tests?
I agree this would be nice. In the meantime/earlier Python versions, it may
be possible to manage with something like I've implemented here:
https://gist.github.com/5805215
This demonstrates that you can pinpoint where a ResourceWarning occurred.
One problem with the warnings module is that it doesn't allow you to have
multiple handlers, filter lists, so the approach might be problematic when
the code under test is monkey-patching the warnings module itself, or
filtering warnings.
Regards,
Vinay Sajip
More information about the Python-ideas
mailing list