Commit 5ae7b1bb authored by Julien Cristau's avatar Julien Cristau
Browse files

Backout "drop pretence of sqlite support from site_cubicweb"

Turns out some tests don't care about GIS data, and being able to
serialize a schema that contains geometries can be useful.  So revert my
change from 7f2ea53ddc8d and add a test to make sure this works.
parent 4599f8dd5529
...@@ -46,6 +46,10 @@ pghelper = get_db_helper('postgres') ...@@ -46,6 +46,10 @@ pghelper = get_db_helper('postgres')
pghelper.TYPE_MAPPING['Geometry'] = pg_geometry_sqltype pghelper.TYPE_MAPPING['Geometry'] = pg_geometry_sqltype
pghelper.TYPE_MAPPING['Geography'] = pg_geography_sqltype pghelper.TYPE_MAPPING['Geography'] = pg_geography_sqltype
sqlitehelper = get_db_helper('sqlite')
sqlitehelper.TYPE_MAPPING['Geometry'] = 'text'
sqlitehelper.TYPE_MAPPING['Geography'] = 'text'
# Add a converter for Geometry # Add a converter for Geometry
def convert_geom(x): def convert_geom(x):
if isinstance(x, SQLExpression): if isinstance(x, SQLExpression):
...@@ -64,6 +68,11 @@ def convert_geog(x): ...@@ -64,6 +68,11 @@ def convert_geog(x):
pghelper.TYPE_CONVERTERS['Geometry'] = convert_geom pghelper.TYPE_CONVERTERS['Geometry'] = convert_geom
pghelper.TYPE_CONVERTERS['Geography'] = convert_geog pghelper.TYPE_CONVERTERS['Geography'] = convert_geog
# actually don't care of sqlite, it's just to make it possible to test
sqlitehelper.TYPE_CONVERTERS['Geometry'] = str
sqlitehelper.TYPE_CONVERTERS['Geography'] = str
class ST_EQUALS(FunctionDescr): class ST_EQUALS(FunctionDescr):
minargs = 2 minargs = 2
......
...@@ -50,6 +50,13 @@ class PostgisTC(testlib.CubicWebTC): ...@@ -50,6 +50,13 @@ class PostgisTC(testlib.CubicWebTC):
cnx.commit() cnx.commit()
class PostgisSQLiteFakeTC(testlib.CubicWebTC):
def test(self):
# do nothing, just make sure we can create the db / serialize the schema
pass
if __name__ == '__main__': if __name__ == '__main__':
import unittest import unittest
unittest.main() unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment