Changeset 8155
- Timestamp:
- 07/30/08 12:46:02 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis/django/contrib/gis/models.py
r7666 r8155 212 212 _srid_info = True 213 213 if settings.DATABASE_ENGINE == 'postgresql_psycopg2': 214 from django.contrib.gis.db.backend.postgis.models import GeometryColumns, SpatialRefSys 214 # Because the PostGIS version is checked when initializing the spatial 215 # backend a `ProgrammingError` will be raised if the PostGIS tables 216 # and functions are not installed. We catch here so it won't be raised when 217 # running the Django test suite. 218 from psycopg2 import ProgrammingError 219 try: 220 from django.contrib.gis.db.backend.postgis.models import GeometryColumns, SpatialRefSys 221 except ProgrammingError: 222 _srid_info = False 215 223 elif settings.DATABASE_ENGINE == 'oracle': 216 from django.contrib.gis.db.backend.oracle.models import GeometryColumns, SpatialRefSys 224 # Same thing as above, except the GEOS library is attempted to be loaded for 225 # `BaseSpatialBackend`, and an exception will be raised during the 226 # Django test suite if it doesn't exist. 227 try: 228 from django.contrib.gis.db.backend.oracle.models import GeometryColumns, SpatialRefSys 229 except: 230 _srid_info = False 217 231 else: 218 232 _srid_info = False django/branches/gis/django/contrib/gis/tests/__init__.py
r7641 r8155 45 45 test_suite_names.append('test_geoip') 46 46 47 def suite(): 48 "Builds a test suite for the GIS package." 47 def geo_suite(): 48 """ 49 Builds a test suite for the GIS package. This is not named 50 `suite` so it will not interfere with the Django test suite (since 51 spatial database tables are required to execute these tests on 52 some backends). 53 """ 49 54 s = TestSuite() 50 55 for test_suite in test_suite_names: … … 55 60 def run(verbosity=1): 56 61 "Runs the tests that do not require geographic (GEOS, GDAL, etc.) models." 57 TextTestRunner(verbosity=verbosity).run( suite())62 TextTestRunner(verbosity=verbosity).run(geo_suite()) 58 63 59 64 def run_tests(module_list, verbosity=1, interactive=True): … … 106 111 # Creating the test suite, adding the test models to INSTALLED_APPS, and 107 112 # adding the model test suites to our suite package. 108 test_suite = suite()113 test_suite = geo_suite() 109 114 for test_model in test_models: 110 115 module_name = 'django.contrib.gis.tests.%s' % test_model
