mirror of
https://github.com/django/django.git
synced 2025-07-05 02:09:13 +00:00
gis: modifed tests and mixin to use the HAS_GDAL flag.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6413 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
07963be5df
commit
1025326602
@ -1,15 +1,10 @@
|
||||
from warnings import warn
|
||||
|
||||
# GEOS is a requirement
|
||||
# GEOS is a requirement, GDAL is not
|
||||
from django.contrib.gis.geos import GEOSGeometry
|
||||
|
||||
# GDAL is a lot more complicated to install, and isn't necessary for many
|
||||
# operations.
|
||||
try:
|
||||
from django.contrib.gis.gdal import HAS_GDAL
|
||||
if HAS_GDAL:
|
||||
from django.contrib.gis.gdal import OGRGeometry, SpatialReference
|
||||
HAS_GDAL = True
|
||||
except ImportError, e:
|
||||
HAS_GDAL = False
|
||||
|
||||
# Until model subclassing is a possibility, a mixin class is used to add
|
||||
# the necessary functions that may be contributed for geographic objects.
|
||||
|
@ -1,15 +1,15 @@
|
||||
import sys
|
||||
from copy import copy
|
||||
from unittest import TestSuite, TextTestRunner
|
||||
import sys
|
||||
from django.contrib.gis.gdal import HAS_GDAL
|
||||
|
||||
|
||||
# Tests that do not require setting up and tearing down a spatial database.
|
||||
test_suite_names = [
|
||||
'test_geos',
|
||||
'test_measure',
|
||||
]
|
||||
try:
|
||||
# GDAL tests
|
||||
import django.contrib.gis.gdal
|
||||
if HAS_GDAL:
|
||||
test_suite_names += [
|
||||
'test_gdal_driver',
|
||||
'test_gdal_ds',
|
||||
@ -17,7 +17,7 @@ try:
|
||||
'test_gdal_srs',
|
||||
'test_spatialrefsys',
|
||||
]
|
||||
except ImportError, e:
|
||||
else:
|
||||
print >>sys.stderr, "GDAL not available - no GDAL tests will be run."
|
||||
|
||||
test_models = ['geoapp']
|
||||
@ -35,7 +35,8 @@ def run(verbosity=1):
|
||||
TextTestRunner(verbosity=verbosity).run(suite())
|
||||
|
||||
def run_tests(module_list, verbosity=1, interactive=True):
|
||||
"""Run the tests that require creation of a spatial database. Does not
|
||||
"""
|
||||
Run the tests that require creation of a spatial database. Does not
|
||||
yet work on Windows platforms.
|
||||
|
||||
In order to run geographic model tests the DATABASE_USER will require
|
||||
|
Loading…
x
Reference in New Issue
Block a user