Skip to content

Commit 7fb5e54

Browse files
committed
Add test (xfail) to read ONHM_SHAPEFILES via URL
1 parent 6b63fea commit 7fb5e54

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

test_shapefile.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,31 @@ def Reader(url):
529529
assert sf.shp.closed is sf.shx.closed is sf.dbf.closed is True
530530

531531

532+
ONHM_URL_PREFIX = "https://github.com/OpenNHM/AvaFrameData/blob/main/avaPopeletzbach"
533+
ONHM_SHAPEFILES = [
534+
"eventArea20090407",
535+
"eventDepositionArea20090407",
536+
"forest20090407",
537+
# "releaseArea20090407" is in this repo as ./shapefiles/test/REL.zip
538+
# and tested in test_reader_zip_polyylinez_no_m_itershaperecords
539+
]
540+
541+
542+
@pytest.mark.network
543+
@pytest.mark.parametrize("shp", ONHM_SHAPEFILES)
544+
def test_reader_url_itershaperecords_ONHM_shapefiles(shp):
545+
"""
546+
Test reading a variety of Open Natural Hazard Modelling's Shapefiles.
547+
Just open them and iterate through. Don't assert anything,
548+
just test that no exception is raised.
549+
"""
550+
if not shp.endswith(".shp"):
551+
shp = f"{shp}.shp"
552+
with shapefile.Reader(f"{ONHM_URL_PREFIX}/{shp}") as sf:
553+
for _shaperec in sf.iterShapeRecords():
554+
pass
555+
556+
532557
def test_reader_zip():
533558
"""
534559
Assert that Reader can open shapefiles inside a zipfile.

0 commit comments

Comments
 (0)