From 1b312edbeb469c58d8518cc0ece9cdb6c37f5c7e Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 16 Dec 2011 23:50:34 +0000 Subject: [PATCH] Refs #17323 -- Updated a test to use try/finally to avoid state leakage. Thanks dstufft for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17211 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/requests/tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/regressiontests/requests/tests.py b/tests/regressiontests/requests/tests.py index 7927d27098..e71c6f6eaa 100644 --- a/tests/regressiontests/requests/tests.py +++ b/tests/regressiontests/requests/tests.py @@ -426,5 +426,7 @@ class RequestsTests(unittest.TestCase): warnings_state = get_warnings_state() warnings.filterwarnings('ignore', category=DeprecationWarning, module='django.http') - self.assertEqual(request.body, request.raw_post_data) - restore_warnings_state(warnings_state) + try: + self.assertEqual(request.body, request.raw_post_data) + finally: + restore_warnings_state(warnings_state)