[Python-Dev] unittest isolation and warnings

Antoine Pitrou solipsis at pitrou.net
Sat Nov 18 06:27:54 EST 2017


Hi Christian,

On Fri, 17 Nov 2017 10:15:24 +0100
Christian Tismer <tismer at stackless.com> wrote:
> 
> Example:
> One of my tests emits warnings when a certain condition is
> met. Instead of reporting the error immediately, it uses
> warnings, and at the end of the test, an error is produced
> if there were warnings.

I suggest you try using subtests.  This would allow you to report
several errors from a given test method.
https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests

Regards

Antoine.




More information about the Python-Dev mailing list