Skip to content

Commit f9b1d3c

Browse files
authored
Merge pull request #12200 from dbaston/autotest-gmlas-skip
autotest gmlas.py: Skip test if external schema URL cannot be accessed
2 parents 1c1db32 + e1a85d6 commit f9b1d3c

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

autotest/ogr/ogr_gmlas.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3434,14 +3434,19 @@ def test_ogr_gmlas_get_gml_and_iso_schemas(tmp_path):
34343434
@pytest.mark.require_curl()
34353435
def test_ogr_gmlas_bugfix_sf_2371():
34363436

3437-
url = (
3438-
"http://repository.gdi-de.org/schemas/adv/citygml/building/1.0/buildingLoD1.xsd"
3437+
urls = (
3438+
"http://repository.gdi-de.org/schemas/adv/citygml/building/1.0/buildingLoD1.xsd",
3439+
"http://docs.oasis-open.org/election/external/xAL.xsd",
34393440
)
3440-
conn = gdaltest.gdalurlopen(url, timeout=4)
3441-
if conn is None:
3442-
pytest.skip(f"cannot open {url}")
34433441

34443442
ds = gdal.OpenEx("GMLAS:data/gmlas/citygml_empty_lod1.gml")
3443+
3444+
if ds is None:
3445+
for url in urls:
3446+
conn = gdaltest.gdalurlopen(url, timeout=4)
3447+
if conn is None:
3448+
pytest.skip(f"cannot open {url}")
3449+
34453450
lyr = ds.GetLayerByName("address1")
34463451
assert lyr.GetFeatureCount() == 0
34473452

@@ -3514,10 +3519,17 @@ def test_ogr_gmlas_choice_inlined(filename, attrname, value):
35143519
@pytest.mark.require_curl()
35153520
def test_ogr_gmlas_citygml_lod2_no_schema_location():
35163521

3517-
url = "https://schemas.opengis.net/citygml/2.0/cityGMLBase.xsd"
3518-
conn = gdaltest.gdalurlopen(url, timeout=4)
3519-
if conn is None:
3520-
pytest.skip(f"cannot open {url}")
3522+
urls = (
3523+
"http://repository.gdi-de.org/schemas/adv/citygml/building/1.0/buildingLoD1.xsd",
3524+
"http://docs.oasis-open.org/election/external/xAL.xsd",
3525+
)
35213526

35223527
ds = gdal.OpenEx("GMLAS:data/gmlas/lod2_empty_no_schema_location.gml")
3528+
3529+
if ds is None:
3530+
for url in urls:
3531+
conn = gdaltest.gdalurlopen(url, timeout=4)
3532+
if conn is None:
3533+
pytest.skip(f"cannot open {url}")
3534+
35233535
assert ds.GetLayerCount() == 1537

0 commit comments

Comments
 (0)