Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Now possible to run the GeoDjango test suite with a minimal s…

…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...
commit 4a8519334d5649f242ea5f8b3a0547b26831129b 1 parent 76a51a3
Justin Bronn authored November 20, 2010

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. 7  django/contrib/gis/tests/__init__.py
7  django/contrib/gis/tests/__init__.py
@@ -29,8 +29,9 @@ def setup_test_environment(self, **kwargs):
29 29
 
30 30
         # Getting and storing the original values of INSTALLED_APPS and
31 31
         # the ROOT_URLCONF.
32  
-        self.old_installed = settings.INSTALLED_APPS
33  
-        self.old_root_urlconf = settings.ROOT_URLCONF
  32
+        self.old_installed = getattr(settings, 'INSTALLED_APPS', None)
  33
+        self.old_root_urlconf = getattr(settings, 'ROOT_URLCONF', None)
  34
+        self.old_site_id = getattr(settings, 'SITE_ID', None)
34 35
 
35 36
         # Tests that require use of a spatial database (e.g., creation of models)
36 37
         self.geo_apps = ['geoapp', 'relatedapp']
@@ -61,11 +62,13 @@ def setup_test_environment(self, **kwargs):
61 62
 
62 63
         # Setting the URLs.
63 64
         settings.ROOT_URLCONF = 'django.contrib.gis.tests.urls'
  65
+        settings.SITE_ID = 1
64 66
 
65 67
     def teardown_test_environment(self, **kwargs):
66 68
         super(GeoDjangoTestSuiteRunner, self).teardown_test_environment(**kwargs)
67 69
         settings.INSTALLED_APPS = self.old_installed
68 70
         settings.ROOT_URLCONF = self.old_root_urlconf
  71
+        settings.SITE_ID = self.old_site_id
69 72
 
70 73
     def build_suite(self, test_labels, extra_tests=None, **kwargs):
71 74
         """

0 notes on commit 4a85193

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