1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Replaced use of TestCase.fail() with assertRaises().

Also removed try/except/fail antipattern that hides exceptions.
This commit is contained in:
Tim Graham
2016-06-28 11:21:26 -04:00
committed by GitHub
parent c1b6f554e4
commit c9ae09addf
30 changed files with 205 additions and 447 deletions

View File

@@ -198,13 +198,7 @@ class SessionTestsMixin(object):
# removed the key) results in a new key being generated.
try:
session = self.backend('1')
try:
session.save()
except AttributeError:
self.fail(
"The session object did not save properly. "
"Middleware may be saving cache items without namespaces."
)
session.save()
self.assertNotEqual(session.session_key, '1')
self.assertIsNone(session.get('cat'))
session.delete()