Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #14123 -- Made AdminDocs tests optional, based on the availabil…

…ity of docutils. Thanks to PaulM for the original report, and Łukasz Rekucki for narrowing down the cause.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13606 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a352154e42d7bcb63994c7deefc976a989dcb0cd 1 parent 806c30c
Russell Keith-Magee authored August 19, 2010

Showing 1 changed file with 33 additions and 26 deletions. Show diff stats Hide diff stats

  1. 59  tests/regressiontests/admin_views/tests.py
59  tests/regressiontests/admin_views/tests.py
@@ -2171,39 +2171,46 @@ def test_user_add_another(self):
2171 2171
         self.assertEquals(User.objects.count(), user_count + 1)
2172 2172
         self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD)
2173 2173
 
2174  
-class AdminDocsTest(TestCase):
2175  
-    fixtures = ['admin-views-users.xml']
  2174
+try:
  2175
+    # If docutils isn't installed, skip the AdminDocs tests.
  2176
+    import docutils
2176 2177
 
2177  
-    def setUp(self):
2178  
-        self.client.login(username='super', password='secret')
  2178
+    class AdminDocsTest(TestCase):
  2179
+        fixtures = ['admin-views-users.xml']
2179 2180
 
2180  
-    def tearDown(self):
2181  
-        self.client.logout()
  2181
+        def setUp(self):
  2182
+            self.client.login(username='super', password='secret')
  2183
+
  2184
+        def tearDown(self):
  2185
+            self.client.logout()
  2186
+
  2187
+        def test_tags(self):
  2188
+            response = self.client.get('/test_admin/admin/doc/tags/')
2182 2189
 
2183  
-    def test_tags(self):
2184  
-        response = self.client.get('/test_admin/admin/doc/tags/')
  2190
+            # The builtin tag group exists
  2191
+            self.assertContains(response, "<h2>Built-in tags</h2>", count=2)
2185 2192
 
2186  
-        # The builtin tag group exists
2187  
-        self.assertContains(response, "<h2>Built-in tags</h2>", count=2)
  2193
+            # A builtin tag exists in both the index and detail
  2194
+            self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
  2195
+            self.assertContains(response, '<li><a href="#autoescape">autoescape</a></li>')
2188 2196
 
2189  
-        # A builtin tag exists in both the index and detail
2190  
-        self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
2191  
-        self.assertContains(response, '<li><a href="#autoescape">autoescape</a></li>')
  2197
+            # An app tag exists in both the index and detail
  2198
+            # The builtin tag group exists
  2199
+            self.assertContains(response, "<h2>admin_list</h2>", count=2)
2192 2200
 
2193  
-        # An app tag exists in both the index and detail
2194  
-        # The builtin tag group exists
2195  
-        self.assertContains(response, "<h2>admin_list</h2>", count=2)
  2201
+            # A builtin tag exists in both the index and detail
  2202
+            self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
  2203
+            self.assertContains(response, '<li><a href="#admin_actions">admin_actions</a></li>')
2196 2204
 
2197  
-        # A builtin tag exists in both the index and detail
2198  
-        self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
2199  
-        self.assertContains(response, '<li><a href="#admin_actions">admin_actions</a></li>')
  2205
+        def test_filters(self):
  2206
+            response = self.client.get('/test_admin/admin/doc/filters/')
2200 2207
 
2201  
-    def test_filters(self):
2202  
-        response = self.client.get('/test_admin/admin/doc/filters/')
  2208
+            # The builtin filter group exists
  2209
+            self.assertContains(response, "<h2>Built-in filters</h2>", count=2)
2203 2210
 
2204  
-        # The builtin filter group exists
2205  
-        self.assertContains(response, "<h2>Built-in filters</h2>", count=2)
  2211
+            # A builtin filter exists in both the index and detail
  2212
+            self.assertContains(response, '<h3 id="add">add</h3>')
  2213
+            self.assertContains(response, '<li><a href="#add">add</a></li>')
2206 2214
 
2207  
-        # A builtin filter exists in both the index and detail
2208  
-        self.assertContains(response, '<h3 id="add">add</h3>')
2209  
-        self.assertContains(response, '<li><a href="#add">add</a></li>')
  2215
+except ImportError:
  2216
+    pass

0 notes on commit a352154

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