Re: [Python-Dev] unittest isolation and warnings

2017-11-18 Thread Antoine Pitrou
Hi Christian, On Fri, 17 Nov 2017 10:15:24 +0100 Christian Tismer 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

Re: [Python-Dev] unittest isolation and warnings

2017-11-18 Thread Christian Tismer
Thanks a lot! Good to know. Ciao -- Chris On 17.11.17 16:44, Brett Cannon wrote: > Tests are not isolated from the warnings system, so things will leak > out. Your best option is to use the context manager in the warnings > module to temporarily make all warnings raise exceptions and test for > t

Re: [Python-Dev] unittest isolation and warnings

2017-11-17 Thread Brett Cannon
Tests are not isolated from the warnings system, so things will leak out. Your best option is to use the context manager in the warnings module to temporarily make all warnings raise exceptions and test for the exception (I'm at the airport, hence why I don't know the name of the context manager; t