SciTools / cartopy

Cartopy - a cartographic python library with matplotlib support
https://scitools.org.uk/cartopy/docs/latest
BSD 3-Clause "New" or "Revised" License
1.42k stars 362 forks source link

Tests fail without scipy #2275

Closed greglucas closed 9 months ago

greglucas commented 1 year ago

Description

Doing a clean install of Cartopy with pip install .[test] ends up with 5 failures and 3 errors due to missing scipy imports. We could either make these optional tests, or add scipy to the testing optional install. Further, would we want to add the other optional things to the test installation? test = ["cartopy[ows,plotting,speedups]", ... i.e. should the testing option be as complete as possible, or should those truly only be if people want to test those branches?

FAILED lib/cartopy/tests/mpl/test_mpl_integration.py::test_quiver_regrid - ImportError: Regridding vectors requires scipy.
FAILED lib/cartopy/tests/mpl/test_mpl_integration.py::test_quiver_regrid_with_extent - ImportError: Regridding vectors requires scipy.
FAILED lib/cartopy/tests/mpl/test_mpl_integration.py::test_barbs_regrid - ImportError: Regridding vectors requires scipy.
FAILED lib/cartopy/tests/mpl/test_mpl_integration.py::test_barbs_regrid_with_extent - ImportError: Regridding vectors requires scipy.
FAILED lib/cartopy/tests/mpl/test_mpl_integration.py::test_streamplot - ImportError: Regridding vectors requires scipy.
ERROR lib/cartopy/tests/test_img_transform.py
ERROR lib/cartopy/tests/test_vector_transform.py
ERROR lib/cartopy/tests/mpl/test_contour.py
dopplershift commented 12 months ago

If the library can work fully without scipy installed, then I'd mark those tests to skip if the library isn't installed. pytest.importorskip is probably helpful here.

lgolston commented 12 months ago

I also think skipping the scipy tests is reasonable in this situation, given that: this is what is already done currently with fiona, and the CI test suite runs with the optional dependencies so those tests aren't neglected.