def testPsycopgInit(self): _PsycopgInit.initialisePsycopgTypes(psycopg_module=psycopg,psycopg_extensions_module=psyco_ext) _PsycopgInit.initialisePsycopgTypes(psycopg_module=psycopg,connect_string="dbname=mq_test user=postgres", psycopg_extensions_module=psyco_ext) _PsycopgInit.initialisePsycopgTypes(psycopg_module=psycopg,connect_string="dbname=mq_test user=postgres", register_opengis_types=1,psycopg_extensions_module=psyco_ext) class MyPoint(Point): pass _PsycopgInit.initialisePsycopgTypes(psycopg_module=psycopg,subclass_map={'point':MyPoint}, psycopg_extensions_module=psyco_ext)
import os import TestConfig if not os.environ.get('USECOVERAGE') == '1': ## from _Point import * ## from _LineSeg import * ## from _Box import * ## from _Path import * ## from _Polygon import * ## from _Circle import * import GeoTypes from _PsycopgInit import initialisePsycopgTypes initialisePsycopgTypes(psycopg_module=psycopg, psycopg_extensions_module=psyco_ext) conn = psycopg.connect('dbname=mq_test user=postgres') curs = conn.cursor() class GeoTypesPointTest(unittest.TestCase): def setUp(self): self.curs = curs self.tbl_name = "test_point_type" try: self.curs.execute("CREATE TABLE %s (p1 point, p2 point)" % (self.tbl_name,)) except: conn.rollback() self.curs.execute("DROP TABLE %s" % (self.tbl_name,))
except ImportError: import psycopg psyco_ext = None import os import TestConfig if not os.environ.get('USECOVERAGE') == '1': import GeoTypes from _PsycopgInit import initialisePsycopgTypes dbname='mq_test' initialisePsycopgTypes(psycopg_module=psycopg,connect_string='dbname=%s user=postgres' % (dbname,), register_opengis_types=1,psycopg_extensions_module=psyco_ext) conn = psycopg.connect('dbname=%s user=postgres' % (dbname,)) curs = conn.cursor() class OGGeoTypesTestBase(unittest.TestCase): def _setUp(self,type): self.curs = curs self.tbl_name_2d = "test_og_point_type2d" self.tbl_name_3d = "test_og_point_type3d" try: conn.rollback() self.curs.execute("CREATE TABLE %s (dummy int)" % (self.tbl_name_2d,)) self.curs.execute("SELECT AddGeometryColumn('%s', '%s', 'p1', 128, '%s', 2 )" % (dbname,self.tbl_name_2d,type))
except ImportError: import psycopg psyco_ext = None import os import TestConfig if not os.environ.get('USECOVERAGE') == '1': import GeoTypes from _PsycopgInit import initialisePsycopgTypes dbname = 'mq_test' initialisePsycopgTypes(psycopg_module=psycopg, connect_string='dbname=%s user=postgres' % (dbname, ), register_opengis_types=1, psycopg_extensions_module=psyco_ext) conn = psycopg.connect('dbname=%s user=postgres' % (dbname, )) curs = conn.cursor() class OGGeoTypesTestBase(unittest.TestCase): def _setUp(self, type): self.curs = curs self.tbl_name_2d = "test_og_point_type2d" self.tbl_name_3d = "test_og_point_type3d" try: conn.rollback() self.curs.execute("CREATE TABLE %s (dummy int)" %