Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Isolate geoapp test from sitemaps app being installed or not

  • Loading branch information...
commit 74bc63b1094582e011aded3e8d0fdd82cf623b5b 1 parent 57815e2
Claude Paroz claudep authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 django/contrib/gis/tests/geoapp/
8 django/contrib/gis/tests/geoapp/
@@ -3,6 +3,7 @@
from io import BytesIO
from unittest import skipUnless
from xml.dom import minidom
+import os
import zipfile
from django.conf import settings
@@ -10,6 +11,7 @@
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.contrib.sites.models import Site
from django.test import TestCase
+from django.utils._os import upath
from .models import City, Country
@@ -37,7 +39,11 @@ def assertChildNodes(self, elem, expected):
def test_geositemap_index(self):
"Tests geographic sitemap index."
# Getting the geo index.
- doc = minidom.parseString(self.client.get('/sitemap.xml').content)
+ from django.contrib import sitemaps
+ template_dirs = settings.TEMPLATE_DIRS + (
+ os.path.join(os.path.dirname(upath(sitemaps.__file__)), 'templates'),)
+ with self.settings(TEMPLATE_DIRS=template_dirs):
+ doc = minidom.parseString(self.client.get('/sitemap.xml').content)
index = doc.firstChild
self.assertEqual(index.getAttribute('xmlns'), '')
self.assertEqual(3, len(index.getElementsByTagName('sitemap')))
Please sign in to comment.
Something went wrong with that request. Please try again.