From e88393c2c200d3b6bf12bcabfce0f9b694f698c9 Mon Sep 17 00:00:00 2001 From: "Alan D. Snow" Date: Wed, 21 Sep 2022 20:35:40 -0500 Subject: [PATCH] TST: Handle OSError on shapely import (#1152) --- .github/workflows/release.yaml | 2 +- requirements-test.txt | 2 +- test/test_doctest_wrapper.py | 4 ++-- test/test_geod.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index dd9cff7a4..2e1e9a174 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -133,7 +133,7 @@ jobs: CIBW_BEFORE_ALL_LINUX: bash ./ci/proj-compile-wheels.sh CIBW_BEFORE_ALL_MACOS: bash ./ci/proj-compile-wheels.sh CIBW_TEST_REQUIRES: cython pytest oldest-supported-numpy pandas xarray - CIBW_BEFORE_TEST: python -m pip install shapely~=1.7.1 || echo "Shapely install failed" + CIBW_BEFORE_TEST: python -m pip install shapely || echo "Shapely install failed" CIBW_TEST_COMMAND: > pyproj -v && python -c "import pyproj; pyproj.Proj(init='epsg:4269')" && diff --git a/requirements-test.txt b/requirements-test.txt index 9e51918cf..1354615e0 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -3,5 +3,5 @@ pytest>3.6 pytest-cov numpy pandas -shapely; python_version < '3.11' +shapely xarray diff --git a/test/test_doctest_wrapper.py b/test/test_doctest_wrapper.py index a871592ee..94079cba0 100644 --- a/test/test_doctest_wrapper.py +++ b/test/test_doctest_wrapper.py @@ -26,8 +26,8 @@ def test_doctests(): failure_count = failure_count_proj + failure_count_crs + failure_count_geod expected_failure_count = 0 try: - import shapely # noqa: F401 pylint: disable=unused-import - except ImportError: + import shapely.geometry # noqa: F401 pylint: disable=unused-import + except (ImportError, OSError): # missing shapely expected_failure_count = 6 diff --git a/test/test_geod.py b/test/test_geod.py index a831a497b..cf2dbf5af 100644 --- a/test/test_geod.py +++ b/test/test_geod.py @@ -27,7 +27,7 @@ from shapely.geometry.polygon import orient SHAPELY_LOADED = True -except ImportError: +except (ImportError, OSError): SHAPELY_LOADED = False