From 74643b08b67c3ae79fc33c20234a951f1993d1f0 Mon Sep 17 00:00:00 2001 From: David Avsajanishvili Date: Tue, 4 Jun 2013 13:42:31 +0400 Subject: [PATCH] Fix catch_warnings for Python 3 --- rest_framework/tests/test_views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/tests/test_views.py b/rest_framework/tests/test_views.py index 48e22e797..095788b42 100644 --- a/rest_framework/tests/test_views.py +++ b/rest_framework/tests/test_views.py @@ -94,7 +94,7 @@ class ClassBasedViewIntegrationTests(TestCase): def test_return_400_error(self): request = factory.post('/', '{"return_400_error": true}', content_type='application/json') - with warnings.catch_warnings(True) as w: + with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') response = self.view(request) self.assertEqual(len(w), 1) @@ -146,7 +146,7 @@ class FunctionBasedViewIntegrationTests(TestCase): def test_return_400_error(self): request = factory.post('/', '{"return_400_error": true}', content_type='application/json') - with warnings.catch_warnings(True) as w: + with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') response = self.view(request) self.assertEqual(len(w), 1)