From 250e2b422b4da93f38cd61319b9b3c9f422e6ede Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 7 Jun 2014 19:35:57 -0400 Subject: [PATCH] Silenced some GIS deprecation warnings; refs #22384. --- django/contrib/gis/tests/geoapp/test_sitemaps.py | 13 ++++++++++++- django/contrib/gis/tests/geoapp/urls.py | 8 ++++++-- docs/releases/1.8.txt | 3 +++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/django/contrib/gis/tests/geoapp/test_sitemaps.py b/django/contrib/gis/tests/geoapp/test_sitemaps.py index e4b1652f1aa..1dbbb87f39c 100644 --- a/django/contrib/gis/tests/geoapp/test_sitemaps.py +++ b/django/contrib/gis/tests/geoapp/test_sitemaps.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from io import BytesIO from unittest import skipUnless from xml.dom import minidom +import warnings import zipfile from django.conf import settings @@ -10,6 +11,7 @@ from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.sites.models import Site from django.test import TestCase, modify_settings, override_settings +from django.utils.deprecation import RemovedInDjango20Warning if HAS_GEOS: from .models import City, Country @@ -33,7 +35,16 @@ class GeoSitemapTest(TestCase): def test_geositemap_kml(self): "Tests KML/KMZ geographic sitemaps." for kml_type in ('kml', 'kmz'): - doc = minidom.parseString(self.client.get('/sitemaps/%s.xml' % kml_type).content) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", category=RemovedInDjango20Warning) + # The URL for the sitemaps in urls.py have been updated + # with a name but since reversing by Python path is tried first + # before reversing by name and works since we're giving + # name='django.contrib.gis.sitemaps.views.(kml|kmz)', we need + # to silence the erroneous warning until reversing by dotted + # path is removed. The test will work without modification when + # it's removed. + doc = minidom.parseString(self.client.get('/sitemaps/%s.xml' % kml_type).content) # Ensuring the right sitemaps namespace is present. urlset = doc.firstChild diff --git a/django/contrib/gis/tests/geoapp/urls.py b/django/contrib/gis/tests/geoapp/urls.py index e6b895f7ff9..238c64ad51c 100644 --- a/django/contrib/gis/tests/geoapp/urls.py +++ b/django/contrib/gis/tests/geoapp/urls.py @@ -18,6 +18,10 @@ urlpatterns += [ ] urlpatterns += [ - url(r'^sitemaps/kml/(?P