Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_visoss_stop_webserver():
if gdaltest.webserver_port == 0:
pytest.skip()
# Clearcache needed to close all connections, since the Python server
# can only handle one connection at a time
gdal.VSICurlClearCache()
webserver.server_stop(gdaltest.webserver_process, gdaltest.webserver_port)
def test_vsicurl_stop_webserver():
if gdaltest.webserver_port == 0:
pytest.skip()
# Clearcache needed to close all connections, since the Python server
# can only handle one connection at a time
gdal.VSICurlClearCache()
webserver.server_stop(gdaltest.webserver_process, gdaltest.webserver_port)
def test_vsigs_stop_webserver():
if gdaltest.webserver_port == 0:
pytest.skip()
# Clearcache needed to close all connections, since the Python server
# can only handle one connection at a time
gdal.VSICurlClearCache()
webserver.server_stop(gdaltest.webserver_process, gdaltest.webserver_port)
def test_vsis3_stop_webserver():
if gdaltest.webserver_port == 0:
pytest.skip()
# Clearcache needed to close all connections, since the Python server
# can only handle one connection at a time
gdal.VSICurlClearCache()
webserver.server_stop(gdaltest.webserver_process, gdaltest.webserver_port)
def test_rda_cleanup():
if gdaltest.rda_drv is None:
pytest.skip()
if gdaltest.webserver_port != 0:
webserver.server_stop(gdaltest.webserver_process, gdaltest.webserver_port)
gdal.RmdirRecursive('/vsimem/cache_dir')
# First try with remote schema download disabled
with gdaltest.error_handler():
ds = gdal.OpenEx('GMLAS:/vsimem/ogr_gmlas_cache.xml', open_options=[
'CONFIG_FILE=false/vsimem/my/gmlas_cache'])
assert ds is None and gdal.GetLastErrorMsg().find('Cannot resolve') >= 0
# Test invalid cache directory
with gdaltest.error_handler():
ds = gdal.OpenEx('GMLAS:/vsimem/ogr_gmlas_cache.xml', open_options=[
'CONFIG_FILE=/inexisting_directory/not/exist'])
if ds is None:
webserver.server_stop(webserver_process, webserver_port)
pytest.fail()
if ds.GetLayerCount() != 1:
webserver.server_stop(webserver_process, webserver_port)
pytest.fail(ds.GetLayerCount())
# Will create the directory and download and cache
ds = gdal.OpenEx('GMLAS:/vsimem/ogr_gmlas_cache.xml', open_options=[
'CONFIG_FILE=/vsimem/my/gmlas_cache'])
if ds is None:
webserver.server_stop(webserver_process, webserver_port)
pytest.fail()
if ds.GetLayerCount() != 1:
webserver.server_stop(webserver_process, webserver_port)
pytest.fail(ds.GetLayerCount())
gdal.Unlink('/vsimem/my/gmlas_cache/' + gdal.ReadDir('/vsimem/my/gmlas_cache')[0])
# Will reuse the directory and download and cache
ds = gdal.OpenEx('GMLAS:/vsimem/ogr_gmlas_cache.xml', open_options=[
def test_vsiaz_stop_webserver():
if gdaltest.webserver_port == 0:
pytest.skip()
# Clearcache needed to close all connections, since the Python server
# can only handle one connection at a time
gdal.VSICurlClearCache()
webserver.server_stop(gdaltest.webserver_process, gdaltest.webserver_port)
def test_ogr_mvt_http_stop():
if gdaltest.webserver_port == 0:
pytest.skip()
webserver.server_stop(gdaltest.webserver_process, gdaltest.webserver_port)
def test_ogr_opaif_cleanup():
if gdaltest.opaif_drv is None:
pytest.skip()
if gdaltest.webserver_port != 0:
webserver.server_stop(gdaltest.webserver_process, gdaltest.webserver_port)
def test_daas_cleanup():
if gdaltest.daas_drv is None:
pytest.skip()
if gdaltest.webserver_port != 0:
webserver.server_stop(gdaltest.webserver_process,
gdaltest.webserver_port)
gdal.RmdirRecursive('/vsimem/cache_dir')
for var in gdaltest.daas_vars:
gdal.SetConfigOption(var, gdaltest.daas_vars[var])