Author: russellm
Date: 2010-08-19 08:11:24 -0500 (Thu, 19 Aug 2010)
New Revision: 13606

Modified:
   django/trunk/tests/regressiontests/admin_views/tests.py
Log:
Fixed #14123 -- Made AdminDocs tests optional, based on the availability of 
docutils. Thanks to PaulM for the original report, and ?\197?\129ukasz Rekucki 
for narrowing down the cause.

Modified: django/trunk/tests/regressiontests/admin_views/tests.py
===================================================================
--- django/trunk/tests/regressiontests/admin_views/tests.py     2010-08-18 
16:35:48 UTC (rev 13605)
+++ django/trunk/tests/regressiontests/admin_views/tests.py     2010-08-19 
13:11:24 UTC (rev 13606)
@@ -2171,39 +2171,46 @@
         self.assertEquals(User.objects.count(), user_count + 1)
         self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD)
 
-class AdminDocsTest(TestCase):
-    fixtures = ['admin-views-users.xml']
+try:
+    # If docutils isn't installed, skip the AdminDocs tests.
+    import docutils
 
-    def setUp(self):
-        self.client.login(username='super', password='secret')
+    class AdminDocsTest(TestCase):
+        fixtures = ['admin-views-users.xml']
 
-    def tearDown(self):
-        self.client.logout()
+        def setUp(self):
+            self.client.login(username='super', password='secret')
 
-    def test_tags(self):
-        response = self.client.get('/test_admin/admin/doc/tags/')
+        def tearDown(self):
+            self.client.logout()
 
-        # The builtin tag group exists
-        self.assertContains(response, "<h2>Built-in tags</h2>", count=2)
+        def test_tags(self):
+            response = self.client.get('/test_admin/admin/doc/tags/')
 
-        # A builtin tag exists in both the index and detail
-        self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
-        self.assertContains(response, '<li><a 
href="#autoescape">autoescape</a></li>')
+            # The builtin tag group exists
+            self.assertContains(response, "<h2>Built-in tags</h2>", count=2)
 
-        # An app tag exists in both the index and detail
-        # The builtin tag group exists
-        self.assertContains(response, "<h2>admin_list</h2>", count=2)
+            # A builtin tag exists in both the index and detail
+            self.assertContains(response, '<h3 
id="autoescape">autoescape</h3>')
+            self.assertContains(response, '<li><a 
href="#autoescape">autoescape</a></li>')
 
-        # A builtin tag exists in both the index and detail
-        self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
-        self.assertContains(response, '<li><a 
href="#admin_actions">admin_actions</a></li>')
+            # An app tag exists in both the index and detail
+            # The builtin tag group exists
+            self.assertContains(response, "<h2>admin_list</h2>", count=2)
 
-    def test_filters(self):
-        response = self.client.get('/test_admin/admin/doc/filters/')
+            # A builtin tag exists in both the index and detail
+            self.assertContains(response, '<h3 
id="autoescape">autoescape</h3>')
+            self.assertContains(response, '<li><a 
href="#admin_actions">admin_actions</a></li>')
 
-        # The builtin filter group exists
-        self.assertContains(response, "<h2>Built-in filters</h2>", count=2)
+        def test_filters(self):
+            response = self.client.get('/test_admin/admin/doc/filters/')
 
-        # A builtin filter exists in both the index and detail
-        self.assertContains(response, '<h3 id="add">add</h3>')
-        self.assertContains(response, '<li><a href="#add">add</a></li>')
+            # The builtin filter group exists
+            self.assertContains(response, "<h2>Built-in filters</h2>", count=2)
+
+            # A builtin filter exists in both the index and detail
+            self.assertContains(response, '<h3 id="add">add</h3>')
+            self.assertContains(response, '<li><a href="#add">add</a></li>')
+
+except ImportError:
+    pass

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

Reply via email to