Skip to content

Commit

Permalink
[1.2.X] Now possible to run the GeoDjango test suite with a minimal s…
Browse files Browse the repository at this point in the history
…ettings file. Refs #10420, #14439.

Backport of r14653 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14654 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jbronn committed Nov 20, 2010
1 parent 76a51a3 commit 4a85193
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions django/contrib/gis/tests/__init__.py
Expand Up @@ -29,8 +29,9 @@ def setup_test_environment(self, **kwargs):

# Getting and storing the original values of INSTALLED_APPS and
# the ROOT_URLCONF.
self.old_installed = settings.INSTALLED_APPS
self.old_root_urlconf = settings.ROOT_URLCONF
self.old_installed = getattr(settings, 'INSTALLED_APPS', None)
self.old_root_urlconf = getattr(settings, 'ROOT_URLCONF', None)
self.old_site_id = getattr(settings, 'SITE_ID', None)

# Tests that require use of a spatial database (e.g., creation of models)
self.geo_apps = ['geoapp', 'relatedapp']
Expand Down Expand Up @@ -61,11 +62,13 @@ def setup_test_environment(self, **kwargs):

# Setting the URLs.
settings.ROOT_URLCONF = 'django.contrib.gis.tests.urls'
settings.SITE_ID = 1

def teardown_test_environment(self, **kwargs):
super(GeoDjangoTestSuiteRunner, self).teardown_test_environment(**kwargs)
settings.INSTALLED_APPS = self.old_installed
settings.ROOT_URLCONF = self.old_root_urlconf
settings.SITE_ID = self.old_site_id

def build_suite(self, test_labels, extra_tests=None, **kwargs):
"""
Expand Down

0 comments on commit 4a85193

Please sign in to comment.