Re: [Python-Dev] test.support.check_warnings

2014年1月12日 04:26:47 -0800

On 2014年1月11日 23:10:43 -0800
Ethan Furman <[email protected]> wrote:
> On 01/11/2014 05:37 PM, Brett Cannon wrote:
> >
> > You're assuming the context manager is doing something magical to verify 
> > that all calls in the block raise the expected
> > exception. What you want to do is execute it in a loop::
> >
> > for test in (...):
> > with support.check_warnings(("automatic int conversions have been 
> > deprecated", DeprecationWarning), quiet=False):
> > exec(test)
> 
> Well, this is test.support! I expect magic! ;)
> 
> Thanks for setting me straight, got it working.
Or you could, you know, use the new assertWarns():
http://docs.python.org/dev/library/unittest.html#unittest.TestCase.assertWarns
Regards
Antoine.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to