コード例 #1
0
ファイル: test_postgis.py プロジェクト: yumatchlab/gaia
    def setUpClass(cls):
        config_file = os.path.join(base_dir, '../conf/test.dist.cfg')
        config = gaia.get_config(config_file)
        cls.user = config['gaia_postgis']['user']
        cls.password = config['gaia_postgis']['password']
        cls.host = config['gaia_postgis']['host']
        cls.dbname = config['gaia_postgis']['dbname']

        try:
            connection = cls.get_connection()
        except OperationalError:
            raise unittest.SkipTest()
        iso_level = connection.connection.connection.isolation_level
        connection.connection.connection.set_isolation_level(0)
        try:
            connection.execute("DROP DATABASE IF EXISTS {}".format(cls.dbname))
            connection.execute("CREATE DATABASE {}".format(cls.dbname))
            connection.close()
            connection.engine.dispose()
            connection = cls.get_connection(cls.dbname)
            connection.execute(text("CREATE EXTENSION postgis;").
                               execution_options(autocommit=True))
            for sqlfile in glob.glob(os.path.join(base_dir, "../data/*.sql")):
                with codecs.open(sqlfile, "r", "utf-8") as inf:
                    sql = inf.read()
                    connection.execute(
                        text(sql).execution_options(autocommit=True))
        finally:
            connection.connection.connection.set_isolation_level(iso_level)
            connection.close()
            connection.engine.dispose()
コード例 #2
0
 def setUpClass(cls):
     config_file = os.path.join(base_dir, '../../gaia/conf/gaia.cfg')
     gaia.get_config(config_file)
コード例 #3
0
ファイル: test_create.py プロジェクト: OpenDataAnalytics/gaia
 def setUpClass(cls):
     config_file = os.path.join(base_dir, '../../gaia/conf/gaia.cfg')
     gaia.get_config(config_file)
コード例 #4
0
ファイル: test_processes.py プロジェクト: snowfox1939/gaia
    def setUpClass(cls):
        config_file = os.path.join(base_dir, '../../gaia/conf/gaia.cfg')
        gaia.get_config(config_file)

        zipfile = ZipFile(os.path.join(testfile_path, '2states.zip'), 'r')
        zipfile.extract('2states.geojson', testfile_path)