Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #21977 -- Deprecated SimpleTestCase.urls in favour of override_settings #2517

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion django/contrib/auth/tests/test_context_processors.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ def test_permlookupdict_in(self):
TEMPLATE_DIRS=( TEMPLATE_DIRS=(
os.path.join(os.path.dirname(upath(__file__)), 'templates'), os.path.join(os.path.dirname(upath(__file__)), 'templates'),
), ),
ROOT_URLCONF='django.contrib.auth.tests.urls',
USE_TZ=False, # required for loading the fixture USE_TZ=False, # required for loading the fixture
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',), PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
) )
class AuthContextProcessorTests(TestCase): class AuthContextProcessorTests(TestCase):
""" """
Tests for the ``django.contrib.auth.context_processors.auth`` processor Tests for the ``django.contrib.auth.context_processors.auth`` processor
""" """
urls = 'django.contrib.auth.tests.urls'
fixtures = ['context-processors-users.xml'] fixtures = ['context-processors-users.xml']


@override_settings( @override_settings(
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/auth/tests/test_decorators.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.http import HttpResponse from django.http import HttpResponse
from django.test import TestCase from django.test import TestCase, override_settings
from django.test.client import RequestFactory from django.test.client import RequestFactory




@skipIfCustomUser @skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.auth.tests.urls')
class LoginRequiredTestCase(AuthViewsTestCase): class LoginRequiredTestCase(AuthViewsTestCase):
""" """
Tests the login_required decorators Tests the login_required decorators
""" """
urls = 'django.contrib.auth.tests.urls'


def testCallable(self): def testCallable(self):
""" """
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/auth/tests/test_remote_user.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from django.contrib.auth.middleware import RemoteUserMiddleware from django.contrib.auth.middleware import RemoteUserMiddleware
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase from django.test import TestCase, override_settings
from django.utils import timezone from django.utils import timezone




@skipIfCustomUser @skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.auth.tests.urls')
class RemoteUserTest(TestCase): class RemoteUserTest(TestCase):


urls = 'django.contrib.auth.tests.urls'
middleware = 'django.contrib.auth.middleware.RemoteUserMiddleware' middleware = 'django.contrib.auth.middleware.RemoteUserMiddleware'
backend = 'django.contrib.auth.backends.RemoteUserBackend' backend = 'django.contrib.auth.backends.RemoteUserBackend'
header = 'REMOTE_USER' header = 'REMOTE_USER'
Expand Down
5 changes: 3 additions & 2 deletions django/contrib/auth/tests/test_signals.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@




@skipIfCustomUser @skipIfCustomUser
@override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(USE_TZ=False,
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF='django.contrib.auth.tests.urls')
class SignalTestCase(TestCase): class SignalTestCase(TestCase):
urls = 'django.contrib.auth.tests.urls'
fixtures = ['authtestdata.json'] fixtures = ['authtestdata.json']


def listener_login(self, user, **kwargs): def listener_login(self, user, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/auth/tests/test_templates.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
@skipIfCustomUser @skipIfCustomUser
@override_settings( @override_settings(
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',), PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF='django.contrib.auth.tests.urls',
) )
class AuthTemplateTests(TestCase): class AuthTemplateTests(TestCase):
urls = 'django.contrib.auth.tests.urls'


def test_titles(self): def test_titles(self):
rf = RequestFactory() rf = RequestFactory()
Expand Down
6 changes: 3 additions & 3 deletions django/contrib/auth/tests/test_views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
), ),
USE_TZ=False, USE_TZ=False,
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',), PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF='django.contrib.auth.tests.urls',
) )
class AuthViewsTestCase(TestCase): class AuthViewsTestCase(TestCase):
""" """
Helper base class for all the follow test cases. Helper base class for all the follow test cases.
""" """
fixtures = ['authtestdata.json'] fixtures = ['authtestdata.json']
urls = 'django.contrib.auth.tests.urls'


def login(self, password='password'): def login(self, password='password'):
response = self.client.post('/login/', { response = self.client.post('/login/', {
Expand Down Expand Up @@ -86,8 +86,8 @@ def assertURLEqual(self, url, expected, parse_qs=False):




@skipIfCustomUser @skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.auth.urls')
class AuthViewNamedURLTests(AuthViewsTestCase): class AuthViewNamedURLTests(AuthViewsTestCase):
urls = 'django.contrib.auth.urls'


def test_named_urls(self): def test_named_urls(self):
"Named URLs should be reversible" "Named URLs should be reversible"
Expand Down Expand Up @@ -732,9 +732,9 @@ def test_logout_preserve_language(self):
@skipIfCustomUser @skipIfCustomUser
@override_settings( @override_settings(
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',), PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF='django.contrib.auth.tests.urls_admin',
) )
class ChangelistTests(AuthViewsTestCase): class ChangelistTests(AuthViewsTestCase):
urls = 'django.contrib.auth.tests.urls_admin'


def setUp(self): def setUp(self):
# Make me a superuser before logging in. # Make me a superuser before logging in.
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/flatpages/tests/test_csrf.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
), ),
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
CSRF_FAILURE_VIEW='django.views.csrf.csrf_failure', CSRF_FAILURE_VIEW='django.views.csrf.csrf_failure',
TEMPLATE_DIRS=( TEMPLATE_DIRS=(
os.path.join(os.path.dirname(__file__), 'templates'), os.path.join(os.path.dirname(__file__), 'templates'),
Expand All @@ -23,7 +24,6 @@
) )
class FlatpageCSRFTests(TestCase): class FlatpageCSRFTests(TestCase):
fixtures = ['sample_flatpages', 'example_site'] fixtures = ['sample_flatpages', 'example_site']
urls = 'django.contrib.flatpages.tests.urls'


def setUp(self): def setUp(self):
self.client = Client(enforce_csrf_checks=True) self.client = Client(enforce_csrf_checks=True)
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/flatpages/tests/test_middleware.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
), ),
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
TEMPLATE_DIRS=( TEMPLATE_DIRS=(
os.path.join(os.path.dirname(__file__), 'templates'), os.path.join(os.path.dirname(__file__), 'templates'),
), ),
SITE_ID=1, SITE_ID=1,
) )
class FlatpageMiddlewareTests(TestCase): class FlatpageMiddlewareTests(TestCase):
fixtures = ['sample_flatpages', 'example_site'] fixtures = ['sample_flatpages', 'example_site']
urls = 'django.contrib.flatpages.tests.urls'


def test_view_flatpage(self): def test_view_flatpage(self):
"A flatpage can be served through a view, even when the middleware is in use" "A flatpage can be served through a view, even when the middleware is in use"
Expand Down Expand Up @@ -96,14 +96,14 @@ def test_fallback_flatpage_special_chars(self):
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
), ),
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
TEMPLATE_DIRS=( TEMPLATE_DIRS=(
os.path.join(os.path.dirname(__file__), 'templates'), os.path.join(os.path.dirname(__file__), 'templates'),
), ),
SITE_ID=1, SITE_ID=1,
) )
class FlatpageMiddlewareAppendSlashTests(TestCase): class FlatpageMiddlewareAppendSlashTests(TestCase):
fixtures = ['sample_flatpages', 'example_site'] fixtures = ['sample_flatpages', 'example_site']
urls = 'django.contrib.flatpages.tests.urls'


def test_redirect_view_flatpage(self): def test_redirect_view_flatpage(self):
"A flatpage can be served through a view and should add a slash" "A flatpage can be served through a view and should add a slash"
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/flatpages/tests/test_templatetags.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
), ),
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
TEMPLATE_DIRS=( TEMPLATE_DIRS=(
os.path.join(os.path.dirname(__file__), 'templates'), os.path.join(os.path.dirname(__file__), 'templates'),
), ),
SITE_ID=1, SITE_ID=1,
) )
class FlatpageTemplateTagTests(TestCase): class FlatpageTemplateTagTests(TestCase):
fixtures = ['sample_flatpages'] fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'


def test_get_flatpages_tag(self): def test_get_flatpages_tag(self):
"The flatpage template tag retrives unregistered prefixed flatpages by default" "The flatpage template tag retrives unregistered prefixed flatpages by default"
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/flatpages/tests/test_views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
# no 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware' # no 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
), ),
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
TEMPLATE_DIRS=( TEMPLATE_DIRS=(
os.path.join(os.path.dirname(__file__), 'templates'), os.path.join(os.path.dirname(__file__), 'templates'),
), ),
SITE_ID=1, SITE_ID=1,
) )
class FlatpageViewTests(TestCase): class FlatpageViewTests(TestCase):
fixtures = ['sample_flatpages', 'example_site'] fixtures = ['sample_flatpages', 'example_site']
urls = 'django.contrib.flatpages.tests.urls'


def test_view_flatpage(self): def test_view_flatpage(self):
"A flatpage can be served through a view" "A flatpage can be served through a view"
Expand Down Expand Up @@ -84,14 +84,14 @@ def test_view_flatpage_special_chars(self):
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
# no 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware' # no 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
), ),
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
TEMPLATE_DIRS=( TEMPLATE_DIRS=(
os.path.join(os.path.dirname(__file__), 'templates'), os.path.join(os.path.dirname(__file__), 'templates'),
), ),
SITE_ID=1, SITE_ID=1,
) )
class FlatpageViewAppendSlashTests(TestCase): class FlatpageViewAppendSlashTests(TestCase):
fixtures = ['sample_flatpages', 'example_site'] fixtures = ['sample_flatpages', 'example_site']
urls = 'django.contrib.flatpages.tests.urls'


def test_redirect_view_flatpage(self): def test_redirect_view_flatpage(self):
"A flatpage can be served through a view and should add a slash" "A flatpage can be served through a view and should add a slash"
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/formtools/tests/tests.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def done(self, request, cleaned_data):
TEMPLATE_DIRS=( TEMPLATE_DIRS=(
os.path.join(os.path.dirname(upath(__file__)), 'templates'), os.path.join(os.path.dirname(upath(__file__)), 'templates'),
), ),
ROOT_URLCONF='django.contrib.formtools.tests.urls',
) )
class PreviewTests(TestCase): class PreviewTests(TestCase):
urls = 'django.contrib.formtools.tests.urls'


def setUp(self): def setUp(self):
super(PreviewTests, self).setUp() super(PreviewTests, self).setUp()
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import QueryDict from django.http import QueryDict
from django.test import TestCase from django.test import TestCase, override_settings


from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
Expand All @@ -13,7 +13,6 @@




class NamedWizardTests(object): class NamedWizardTests(object):
urls = 'django.contrib.formtools.tests.wizard.namedwizardtests.urls'


def setUp(self): def setUp(self):
self.testuser, created = User.objects.get_or_create(username='testuser1') self.testuser, created = User.objects.get_or_create(username='testuser1')
Expand Down Expand Up @@ -283,6 +282,7 @@ def test_form_reset(self):




@skipIfCustomUser @skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.namedwizardtests.urls')
class NamedSessionWizardTests(NamedWizardTests, TestCase): class NamedSessionWizardTests(NamedWizardTests, TestCase):
wizard_urlname = 'nwiz_session' wizard_urlname = 'nwiz_session'
wizard_step_1_data = { wizard_step_1_data = {
Expand Down Expand Up @@ -315,6 +315,7 @@ class NamedSessionWizardTests(NamedWizardTests, TestCase):




@skipIfCustomUser @skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.namedwizardtests.urls')
class NamedCookieWizardTests(NamedWizardTests, TestCase): class NamedCookieWizardTests(NamedWizardTests, TestCase):
wizard_urlname = 'nwiz_cookie' wizard_urlname = 'nwiz_cookie'
wizard_step_1_data = { wizard_step_1_data = {
Expand Down Expand Up @@ -347,7 +348,6 @@ class NamedCookieWizardTests(NamedWizardTests, TestCase):




class NamedFormTests(object): class NamedFormTests(object):
urls = 'django.contrib.formtools.tests.wizard.namedwizardtests.urls'


def test_revalidation(self): def test_revalidation(self):
request = get_request() request = get_request()
Expand Down Expand Up @@ -376,12 +376,14 @@ def dispatch(self, request, *args, **kwargs):




@skipIfCustomUser @skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.namedwizardtests.urls')
class NamedSessionFormTests(NamedFormTests, TestCase): class NamedSessionFormTests(NamedFormTests, TestCase):
formwizard_class = TestNamedUrlSessionWizardView formwizard_class = TestNamedUrlSessionWizardView
wizard_urlname = 'nwiz_session' wizard_urlname = 'nwiz_session'




@skipIfCustomUser @skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.namedwizardtests.urls')
class NamedCookieFormTests(NamedFormTests, TestCase): class NamedCookieFormTests(NamedFormTests, TestCase):
formwizard_class = TestNamedUrlCookieWizardView formwizard_class = TestNamedUrlCookieWizardView
wizard_urlname = 'nwiz_cookie' wizard_urlname = 'nwiz_cookie'
7 changes: 4 additions & 3 deletions django/contrib/formtools/tests/wizard/wizardtests/tests.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os import os


from django import forms from django import forms
from django.test import TestCase from django.test import TestCase, override_settings
from django.test.client import RequestFactory from django.test.client import RequestFactory
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
Expand All @@ -24,7 +24,6 @@ class Meta:




class WizardTests(object): class WizardTests(object):
urls = 'django.contrib.formtools.tests.wizard.wizardtests.urls'


def setUp(self): def setUp(self):
self.testuser, created = User.objects.get_or_create(username='testuser1') self.testuser, created = User.objects.get_or_create(username='testuser1')
Expand Down Expand Up @@ -208,6 +207,7 @@ def test_form_refresh(self):




@skipIfCustomUser @skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.wizardtests.urls')
class SessionWizardTests(WizardTests, TestCase): class SessionWizardTests(WizardTests, TestCase):
wizard_url = '/wiz_session/' wizard_url = '/wiz_session/'
wizard_step_1_data = { wizard_step_1_data = {
Expand Down Expand Up @@ -240,6 +240,7 @@ class SessionWizardTests(WizardTests, TestCase):




@skipIfCustomUser @skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.wizardtests.urls')
class CookieWizardTests(WizardTests, TestCase): class CookieWizardTests(WizardTests, TestCase):
wizard_url = '/wiz_cookie/' wizard_url = '/wiz_cookie/'
wizard_step_1_data = { wizard_step_1_data = {
Expand Down Expand Up @@ -272,6 +273,7 @@ class CookieWizardTests(WizardTests, TestCase):




@skipIfCustomUser @skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.wizardtests.urls')
class WizardTestKwargs(TestCase): class WizardTestKwargs(TestCase):
wizard_url = '/wiz_other_template/' wizard_url = '/wiz_other_template/'
wizard_step_1_data = { wizard_step_1_data = {
Expand Down Expand Up @@ -301,7 +303,6 @@ class WizardTestKwargs(TestCase):
'cookie_contact_wizard-current_step': 'form4', 'cookie_contact_wizard-current_step': 'form4',
} }
) )
urls = 'django.contrib.formtools.tests.wizard.wizardtests.urls'


def setUp(self): def setUp(self):
self.testuser, created = User.objects.get_or_create(username='testuser1') self.testuser, created = User.objects.get_or_create(username='testuser1')
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/gis/tests/geoadmin/tests.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.test import TestCase from django.test import TestCase, override_settings


if HAS_GEOS and HAS_SPATIAL_DB: if HAS_GEOS and HAS_SPATIAL_DB:
from django.contrib.gis import admin from django.contrib.gis import admin
Expand All @@ -14,8 +14,8 @@




@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.") @skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
@override_settings(ROOT_URLCONF='django.contrib.gis.tests.geoadmin.urls')
class GeoAdminTest(TestCase): class GeoAdminTest(TestCase):
urls = 'django.contrib.gis.tests.geoadmin.urls'


def test_ensure_geographic_media(self): def test_ensure_geographic_media(self):
geoadmin = admin.site._registry[City] geoadmin = admin.site._registry[City]
Expand Down
5 changes: 2 additions & 3 deletions django/contrib/gis/tests/geoapp/test_feeds.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.test import TestCase, modify_settings from django.test import TestCase, modify_settings, override_settings


if HAS_GEOS: if HAS_GEOS:
from .models import City from .models import City




@modify_settings(INSTALLED_APPS={'append': 'django.contrib.sites'}) @modify_settings(INSTALLED_APPS={'append': 'django.contrib.sites'})
@override_settings(ROOT_URLCONF='django.contrib.gis.tests.geoapp.urls')
@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.") @skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
class GeoFeedTest(TestCase): class GeoFeedTest(TestCase):


urls = 'django.contrib.gis.tests.geoapp.urls'

def setUp(self): def setUp(self):
Site(id=settings.SITE_ID, domain="example.com", name="example.com").save() Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()


Expand Down
5 changes: 2 additions & 3 deletions django/contrib/gis/tests/geoapp/test_sitemaps.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.test import TestCase, modify_settings from django.test import TestCase, modify_settings, override_settings


if HAS_GEOS: if HAS_GEOS:
from .models import City, Country from .models import City, Country




@modify_settings(INSTALLED_APPS={'append': ['django.contrib.sites', 'django.contrib.sitemaps']}) @modify_settings(INSTALLED_APPS={'append': ['django.contrib.sites', 'django.contrib.sitemaps']})
@override_settings(ROOT_URLCONF='django.contrib.gis.tests.geoapp.urls')
@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.") @skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
class GeoSitemapTest(TestCase): class GeoSitemapTest(TestCase):


urls = 'django.contrib.gis.tests.geoapp.urls'

def setUp(self): def setUp(self):
super(GeoSitemapTest, self).setUp() super(GeoSitemapTest, self).setUp()
Site(id=settings.SITE_ID, domain="example.com", name="example.com").save() Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()
Expand Down
Loading