Re: utils.suppress_warning, TestCase.assertWarns

2016-04-04 Thread Shai Berger
On Monday 04 April 2016 18:37:39 Tim Graham wrote: > I think django.test.ignore_warnings may meet your needs. > Yes, probably. I had misunderstood the warnings.catch_warnings() documentation (and might have misunderstood the django.test.ignore_warnings documentation as well, if there was such d

Re: utils.suppress_warning, TestCase.assertWarns

2016-04-04 Thread Tim Graham
I think django.test.ignore_warnings may meet your needs. As for the latter idea, unless something is really eager to add a Python 2 compatible version (if possible) to Django's SimpleTestCase, we can wait until dropping Python 2 support and then use the TestCase.assertWarns() in Python 3.2+. O

utils.suppress_warning, TestCase.assertWarns

2016-04-03 Thread Shai Berger
Hi all, While working on a ticket that had to do with cookies, I found myself writing this code (essentially): with warnings.catch_warnings(record=True) as warnings_log: # # Begin actual code I'm trying to test # CsrfViewMiddleware().proces