[Python-Dev] test.support.check_warnings (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Sun Jan 12 13:24:46 CET 2014
- Previous message: [Python-Dev] test.support.check_warnings
- Next message: [Python-Dev] test.support.check_warnings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 11 Jan 2014 23:10:43 -0800 Ethan Furman <ethan at stoneleaf.us> 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.checkwarnings(("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.
- Previous message: [Python-Dev] test.support.check_warnings
- Next message: [Python-Dev] test.support.check_warnings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]