Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed error message test assertions under Python 3.3

Thanks Florian Apolloner for testing.
  • Loading branch information...
commit 40260bc30b11bfe0134107bf9dc82a0cd1dcd800 1 parent 7c5b244
@claudep claudep authored
Showing with 8 additions and 12 deletions.
  1. +8 −12 tests/regressiontests/file_storage/tests.py
View
20 tests/regressiontests/file_storage/tests.py
@@ -55,11 +55,9 @@ def test_get_invalid_storage_module(self):
"""
get_storage_class raises an error if the requested import don't exist.
"""
- self.assertRaisesMessage(
- ImproperlyConfigured,
- "Error importing module storage: \"No module named storage\"",
- get_storage_class,
- 'storage.NonExistingStorage')
+ with six.assertRaisesRegex(self, ImproperlyConfigured,
+ "Error importing module storage: \"No module named '?storage'?\""):
+ get_storage_class('storage.NonExistingStorage')
def test_get_nonexisting_storage_class(self):
"""
@@ -77,13 +75,11 @@ def test_get_nonexisting_storage_module(self):
get_storage_class raises an error if the requested module don't exist.
"""
# Error message may or may not be the fully qualified path.
- six.assertRaisesRegex(self,
- ImproperlyConfigured,
- 'Error importing module django.core.files.non_existing_storage: '
- '"No module named non_existing_storage"',
- get_storage_class,
- 'django.core.files.non_existing_storage.NonExistingStorage'
- )
+ with six.assertRaisesRegex(self, ImproperlyConfigured,
+ "Error importing module django.core.files.non_existing_storage: "
+ "\"No module named '?(django.core.files.)?non_existing_storage'?\""):
+ get_storage_class(
+ 'django.core.files.non_existing_storage.NonExistingStorage')
class FileStorageTests(unittest.TestCase):
storage_class = FileSystemStorage
Please sign in to comment.
Something went wrong with that request. Please try again.