Author: carljm
Date: 2011-10-26 14:07:12 -0700 (Wed, 26 Oct 2011)
New Revision: 17041

Modified:
   django/trunk/tests/regressiontests/wsgi/tests.py
Log:
Fixed error message string assumptions in WSGI tests (were breaking tests on 
PyPy). Thanks to Alex Gaynor for the report.

Modified: django/trunk/tests/regressiontests/wsgi/tests.py
===================================================================
--- django/trunk/tests/regressiontests/wsgi/tests.py    2011-10-26 21:03:18 UTC 
(rev 17040)
+++ django/trunk/tests/regressiontests/wsgi/tests.py    2011-10-26 21:07:12 UTC 
(rev 17041)
@@ -83,20 +83,17 @@
 
     @override_settings(WSGI_APPLICATION="regressiontests.wsgi.noexist.app")
     def test_bad_module(self):
-        with self.assertRaises(ImproperlyConfigured) as cm:
+        with self.assertRaisesRegexp(
+            ImproperlyConfigured,
+            r"^WSGI application 'regressiontests.wsgi.noexist.app' could not 
be loaded; could not import module 'regressiontests.wsgi.noexist':"):
+
             get_internal_wsgi_application()
 
-        self.assertEqual(
-            str(cm.exception),
-            "WSGI application 'regressiontests.wsgi.noexist.app' could not be 
loaded; could not import module 'regressiontests.wsgi.noexist': No module named 
noexist")
 
-
     @override_settings(WSGI_APPLICATION="regressiontests.wsgi.wsgi.noexist")
     def test_bad_name(self):
-        with self.assertRaises(ImproperlyConfigured) as cm:
-            get_internal_wsgi_application()
+        with self.assertRaisesRegexp(
+            ImproperlyConfigured,
+            r"^WSGI application 'regressiontests.wsgi.wsgi.noexist' could not 
be loaded; can't find 'noexist' in module 'regressiontests.wsgi.wsgi':"):
 
-        self.assertEqual(
-            str(cm.exception),
-            "WSGI application 'regressiontests.wsgi.wsgi.noexist' could not be 
loaded; can't find 'noexist' in module 'regressiontests.wsgi.wsgi': 'module' 
object has no attribute 'noexist'")
-
+            get_internal_wsgi_application()

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to