1
0
mirror of https://github.com/django/django.git synced 2024-12-25 02:26:12 +00:00

Fixed error message test assertions under Python 3.3

Thanks Florian Apolloner for testing.
This commit is contained in:
Claude Paroz 2013-02-04 18:00:19 +01:00
parent 7c5b244826
commit 40260bc30b

View File

@ -55,11 +55,9 @@ class GetStorageClassTests(SimpleTestCase):
""" """
get_storage_class raises an error if the requested import don't exist. get_storage_class raises an error if the requested import don't exist.
""" """
self.assertRaisesMessage( with six.assertRaisesRegex(self, ImproperlyConfigured,
ImproperlyConfigured, "Error importing module storage: \"No module named '?storage'?\""):
"Error importing module storage: \"No module named storage\"", get_storage_class('storage.NonExistingStorage')
get_storage_class,
'storage.NonExistingStorage')
def test_get_nonexisting_storage_class(self): def test_get_nonexisting_storage_class(self):
""" """
@ -77,13 +75,11 @@ class GetStorageClassTests(SimpleTestCase):
get_storage_class raises an error if the requested module don't exist. get_storage_class raises an error if the requested module don't exist.
""" """
# Error message may or may not be the fully qualified path. # Error message may or may not be the fully qualified path.
six.assertRaisesRegex(self, with six.assertRaisesRegex(self, ImproperlyConfigured,
ImproperlyConfigured, "Error importing module django.core.files.non_existing_storage: "
'Error importing module django.core.files.non_existing_storage: ' "\"No module named '?(django.core.files.)?non_existing_storage'?\""):
'"No module named non_existing_storage"', get_storage_class(
get_storage_class, 'django.core.files.non_existing_storage.NonExistingStorage')
'django.core.files.non_existing_storage.NonExistingStorage'
)
class FileStorageTests(unittest.TestCase): class FileStorageTests(unittest.TestCase):
storage_class = FileSystemStorage storage_class = FileSystemStorage