Fixed #17278 -- Enabled the spatialite GIS tests to run without having to specify a database name in the settings. Thanks to Aymeric for the report and to Ramiro for the initial patch.

This commit is contained in:
Julien Phalip 2012-08-19 02:17:45 -07:00
parent cccbb6bff3
commit 675431dfaa
2 changed files with 7 additions and 5 deletions

View File

@ -30,6 +30,7 @@ class SpatiaLiteCreation(DatabaseCreation):
self.connection.close() self.connection.close()
self.connection.settings_dict["NAME"] = test_database_name self.connection.settings_dict["NAME"] = test_database_name
self.connection.ops.confirm_spatial_components_versions()
# Need to load the SpatiaLite initialization SQL before running `syncdb`. # Need to load the SpatiaLite initialization SQL before running `syncdb`.
self.load_spatialite_sql() self.load_spatialite_sql()

View File

@ -113,6 +113,12 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
def __init__(self, connection): def __init__(self, connection):
super(DatabaseOperations, self).__init__(connection) super(DatabaseOperations, self).__init__(connection)
# Creating the GIS terms dictionary.
gis_terms = ['isnull']
gis_terms += self.geometry_functions.keys()
self.gis_terms = dict([(term, None) for term in gis_terms])
def confirm_spatial_components_versions(self):
# Determine the version of the SpatiaLite library. # Determine the version of the SpatiaLite library.
try: try:
vtup = self.spatialite_version_tuple() vtup = self.spatialite_version_tuple()
@ -129,11 +135,6 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
'SQL loaded on this database?' % 'SQL loaded on this database?' %
(self.connection.settings_dict['NAME'], msg)) (self.connection.settings_dict['NAME'], msg))
# Creating the GIS terms dictionary.
gis_terms = ['isnull']
gis_terms += list(self.geometry_functions)
self.gis_terms = dict([(term, None) for term in gis_terms])
if version >= (2, 4, 0): if version >= (2, 4, 0):
# Spatialite 2.4.0-RC4 added AsGML and AsKML, however both # Spatialite 2.4.0-RC4 added AsGML and AsKML, however both
# RC2 (shipped in popular Debian/Ubuntu packages) and RC4 # RC2 (shipped in popular Debian/Ubuntu packages) and RC4