summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-06-15 11:14:59 +0200
committerClaude Paroz <claude@2xlibre.net>2013-06-15 11:14:59 +0200
commitbeb652e069d386fa6295dd235d7ba84a95e9d484 (patch)
tree8ec969a98f64cd6c788dcb8992d1bec0458829d2
parent990f8d92dca913462f656387b012801f01c96244 (diff)
Worked around Python 3.3 modified exception repr
Refs #20599.
-rw-r--r--django/contrib/auth/tests/test_hashers.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/contrib/auth/tests/test_hashers.py b/django/contrib/auth/tests/test_hashers.py
index 9a72df2075..4becc2dffe 100644
--- a/django/contrib/auth/tests/test_hashers.py
+++ b/django/contrib/auth/tests/test_hashers.py
@@ -5,6 +5,7 @@ from django.conf.global_settings import PASSWORD_HASHERS as default_hashers
from django.contrib.auth.hashers import (is_password_usable, BasePasswordHasher,
check_password, make_password, PBKDF2PasswordHasher, load_hashers,
PBKDF2SHA1PasswordHasher, get_hasher, identify_hasher, UNUSABLE_PASSWORD)
+from django.utils import six
from django.utils import unittest
from django.utils.unittest import skipUnless
@@ -187,7 +188,7 @@ class TestUtilsHashPass(unittest.TestCase):
def test_load_library_importerror(self):
PlainHasher = type(str('PlainHasher'), (BasePasswordHasher,),
{'algorithm': 'plain', 'library': 'plain'})
- with self.assertRaises(ValueError) as e:
+ # Python 3.3 adds quotes around module name
+ with six.assertRaisesRegex(self, ValueError,
+ "Couldn't load 'PlainHasher' algorithm library: No module named '?plain'?"):
PlainHasher()._load_library()
- self.assertEqual("Couldn't load 'PlainHasher' algorithm library: "
- "No module named plain", str(e.exception))