Skip to content

Commit

Permalink
test_provider_ogr_gpkg.py: make test robust to GDAL exceptions turned on
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed May 20, 2024
1 parent b7bfdda commit b049d23
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/src/python/test_provider_ogr_gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2323,7 +2323,8 @@ def _testVectorLayerExporterDeferredSpatialIndex(self, layerOptions, expectSpati

tmpfile = os.path.join(
self.basetestpath, 'testVectorLayerExporterDeferredSpatialIndex.gpkg')
gdal.Unlink(tmpfile)
if os.path.exists(tmpfile):
os.unlink(tmpfile)
options = {}
options['driverName'] = 'GPKG'
options['layerName'] = 'table1'
Expand Down Expand Up @@ -2442,7 +2443,10 @@ def testFixWrongMetadataReferenceColumnNameUpdate(self):

ds = ogr.Open(tmpfile, update=1)
gdal.PushErrorHandler()
ds.ExecuteSQL('DROP TRIGGER gpkg_metadata_reference_column_name_update')
try:
ds.ExecuteSQL('DROP TRIGGER gpkg_metadata_reference_column_name_update')
except Exception:
pass
gdal.PopErrorHandler()
# inject wrong trigger on purpose
wrong_trigger = "CREATE TRIGGER 'gpkg_metadata_reference_column_name_update' " + \
Expand Down

0 comments on commit b049d23

Please sign in to comment.