Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed warning check in test_load_overlong_key

Some backends issue a warning here, others not. This is not the primary
goal of the test, so the assertion about the warning has been removed.
Thanks Carl Meyer for noticing the issue and suggesting the fix.
  • Loading branch information...
commit d7853c55ed027cdffcda88205b9d5c16861a5bcb 1 parent 3bdb65d
Claude Paroz authored September 08, 2012

Showing 1 changed file with 4 additions and 6 deletions. Show diff stats Hide diff stats

  1. 10  django/contrib/sessions/tests.py
10  django/contrib/sessions/tests.py
@@ -302,11 +302,10 @@ def test_exists_searches_cache_first(self):
302 302
             self.assertTrue(self.session.exists(self.session.session_key))
303 303
 
304 304
     def test_load_overlong_key(self):
305  
-        with warnings.catch_warnings(record=True) as w:
306  
-            warnings.simplefilter("always")
  305
+        # Some backends might issue a warning
  306
+        with warnings.catch_warnings():
307 307
             self.session._session_key = (string.ascii_letters + string.digits) * 20
308 308
             self.assertEqual(self.session.load(), {})
309  
-            self.assertEqual(len(w), 1)
310 309
 
311 310
 
312 311
 @override_settings(USE_TZ=True)
@@ -352,11 +351,10 @@ class CacheSessionTests(SessionTestsMixin, unittest.TestCase):
352 351
     backend = CacheSession
353 352
 
354 353
     def test_load_overlong_key(self):
355  
-        with warnings.catch_warnings(record=True) as w:
356  
-            warnings.simplefilter("always")
  354
+        # Some backends might issue a warning
  355
+        with warnings.catch_warnings():
357 356
             self.session._session_key = (string.ascii_letters + string.digits) * 20
358 357
             self.assertEqual(self.session.load(), {})
359  
-            self.assertEqual(len(w), 1)
360 358
 
361 359
 
362 360
 class SessionMiddlewareTests(unittest.TestCase):

0 notes on commit d7853c5

Please sign in to comment.
Something went wrong with that request. Please try again.