def test_ogr2ogr_py_7(): import ogr_pg script_path = test_py_scripts.get_py_script('ogr2ogr') if script_path is None: return 'skip' if test_cli_utilities.get_ogrinfo_path() is None: return 'skip' import gdal ogr_pg.ogr_pg_1() if gdaltest.pg_ds is None: return 'skip' gdaltest.pg_ds.Destroy() gdaltest.runexternal(test_cli_utilities.get_ogrinfo_path() + ' PG:"' + gdaltest.pg_connection_string + '" -sql "DELLAYER:tpoly"') test_py_scripts.run_py_script(script_path, 'ogr2ogr', '-f PostgreSQL PG:"' + gdaltest.pg_connection_string + '" ../ogr/data/poly.shp -nln tpoly -gt 1') ds = ogr.Open('PG:' + gdaltest.pg_connection_string) if ds is None or ds.GetLayerByName('tpoly').GetFeatureCount() != 10: return 'fail' ds.Destroy() gdaltest.runexternal(test_cli_utilities.get_ogrinfo_path() + ' PG:"' + gdaltest.pg_connection_string + '" -sql "DELLAYER:tpoly"') return 'success'
def test_ogr2ogr_6(): import ogr_pg if test_cli_utilities.get_ogr2ogr_path() is None: return 'skip' if test_cli_utilities.get_ogrinfo_path() is None: return 'skip' ogr_pg.ogr_pg_1() if gdaltest.pg_ds is None: return 'skip' gdaltest.pg_ds.Destroy() gdaltest.runexternal(test_cli_utilities.get_ogrinfo_path() + ' PG:"' + gdaltest.pg_connection_string + '" -sql "DELLAYER:tpoly"') gdaltest.runexternal(test_cli_utilities.get_ogr2ogr_path() + ' -f PostgreSQL PG:"' + gdaltest.pg_connection_string + '" ../ogr/data/poly.shp -nln tpoly') gdaltest.runexternal(test_cli_utilities.get_ogr2ogr_path() + ' -update -overwrite -f PostgreSQL PG:"' + gdaltest.pg_connection_string + '" ../ogr/data/poly.shp -nln tpoly') ds = ogr.Open('PG:' + gdaltest.pg_connection_string) if ds is None or ds.GetLayerByName('tpoly').GetFeatureCount() != 10: return 'fail' ds.Destroy() gdaltest.runexternal(test_cli_utilities.get_ogrinfo_path() + ' PG:"' + gdaltest.pg_connection_string + '" -sql "DELLAYER:tpoly"') return 'success'
def test_ogr2ogr_py_6(): import ogr_pg script_path = test_py_scripts.get_py_script("ogr2ogr") if script_path is None: return "skip" if test_cli_utilities.get_ogrinfo_path() is None: return "skip" import gdal ogr_pg.ogr_pg_1() if gdaltest.pg_ds is None: return "skip" gdaltest.pg_ds.Destroy() gdaltest.runexternal( test_cli_utilities.get_ogrinfo_path() + ' PG:"' + gdaltest.pg_connection_string + '" -sql "DELLAYER:tpoly"' ) test_py_scripts.run_py_script( script_path, "ogr2ogr", '-f PostgreSQL PG:"' + gdaltest.pg_connection_string + '" ../ogr/data/poly.shp -nln tpoly', ) test_py_scripts.run_py_script( script_path, "ogr2ogr", '-update -overwrite -f PostgreSQL PG:"' + gdaltest.pg_connection_string + '" ../ogr/data/poly.shp -nln tpoly', ) ds = ogr.Open("PG:" + gdaltest.pg_connection_string) if ds is None or ds.GetLayerByName("tpoly").GetFeatureCount() != 10: return "fail" ds.Destroy() gdaltest.runexternal( test_cli_utilities.get_ogrinfo_path() + ' PG:"' + gdaltest.pg_connection_string + '" -sql "DELLAYER:tpoly"' ) return "success"