Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Isolate geoapp test from sitemaps app being installed or not

  • Loading branch information...
commit 74bc63b1094582e011aded3e8d0fdd82cf623b5b 1 parent 57815e2
Claude Paroz authored
8  django/contrib/gis/tests/geoapp/test_sitemaps.py
@@ -3,6 +3,7 @@
3 3
 from io import BytesIO
4 4
 from unittest import skipUnless
5 5
 from xml.dom import minidom
  6
+import os
6 7
 import zipfile
7 8
 
8 9
 from django.conf import settings
@@ -10,6 +11,7 @@
10 11
 from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
11 12
 from django.contrib.sites.models import Site
12 13
 from django.test import TestCase
  14
+from django.utils._os import upath
13 15
 
14 16
 if HAS_GEOS:
15 17
     from .models import City, Country
@@ -37,7 +39,11 @@ def assertChildNodes(self, elem, expected):
37 39
     def test_geositemap_index(self):
38 40
         "Tests geographic sitemap index."
39 41
         # Getting the geo index.
40  
-        doc = minidom.parseString(self.client.get('/sitemap.xml').content)
  42
+        from django.contrib import sitemaps
  43
+        template_dirs = settings.TEMPLATE_DIRS + (
  44
+            os.path.join(os.path.dirname(upath(sitemaps.__file__)), 'templates'),)
  45
+        with self.settings(TEMPLATE_DIRS=template_dirs):
  46
+            doc = minidom.parseString(self.client.get('/sitemap.xml').content)
41 47
         index = doc.firstChild
42 48
         self.assertEqual(index.getAttribute('xmlns'), 'http://www.sitemaps.org/schemas/sitemap/0.9')
43 49
         self.assertEqual(3, len(index.getElementsByTagName('sitemap')))

0 notes on commit 74bc63b

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