Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed error message test assertions under Python 3.3

Thanks Florian Apolloner for testing.
  • Loading branch information...
commit 40260bc30b11bfe0134107bf9dc82a0cd1dcd800 1 parent 7c5b244
Claude Paroz authored February 04, 2013
20  tests/regressiontests/file_storage/tests.py
@@ -55,11 +55,9 @@ def test_get_invalid_storage_module(self):
55 55
         """
56 56
         get_storage_class raises an error if the requested import don't exist.
57 57
         """
58  
-        self.assertRaisesMessage(
59  
-            ImproperlyConfigured,
60  
-            "Error importing module storage: \"No module named storage\"",
61  
-            get_storage_class,
62  
-            'storage.NonExistingStorage')
  58
+        with six.assertRaisesRegex(self, ImproperlyConfigured,
  59
+                "Error importing module storage: \"No module named '?storage'?\""):
  60
+            get_storage_class('storage.NonExistingStorage')
63 61
 
64 62
     def test_get_nonexisting_storage_class(self):
65 63
         """
@@ -77,13 +75,11 @@ def test_get_nonexisting_storage_module(self):
77 75
         get_storage_class raises an error if the requested module don't exist.
78 76
         """
79 77
         # Error message may or may not be the fully qualified path.
80  
-        six.assertRaisesRegex(self,
81  
-            ImproperlyConfigured,
82  
-            'Error importing module django.core.files.non_existing_storage: '
83  
-            '"No module named non_existing_storage"',
84  
-            get_storage_class,
85  
-            'django.core.files.non_existing_storage.NonExistingStorage'
86  
-        )
  78
+        with six.assertRaisesRegex(self, ImproperlyConfigured,
  79
+                "Error importing module django.core.files.non_existing_storage: "
  80
+                "\"No module named '?(django.core.files.)?non_existing_storage'?\""):
  81
+            get_storage_class(
  82
+                'django.core.files.non_existing_storage.NonExistingStorage')
87 83
 
88 84
 class FileStorageTests(unittest.TestCase):
89 85
     storage_class = FileSystemStorage

0 notes on commit 40260bc

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