diff --git a/xarray/tests/__init__.py b/xarray/tests/__init__.py index 71ae1a7075f..6b54994f311 100644 --- a/xarray/tests/__init__.py +++ b/xarray/tests/__init__.py @@ -87,6 +87,7 @@ def _importorskip( has_matplotlib, requires_matplotlib = _importorskip("matplotlib") has_scipy, requires_scipy = _importorskip("scipy") +has_scipy_ge_1_13, requires_scipy_ge_1_13 = _importorskip("scipy", "1.13") with warnings.catch_warnings(): warnings.filterwarnings( "ignore", diff --git a/xarray/tests/test_interp.py b/xarray/tests/test_interp.py index a13f9918b80..f0c7f959687 100644 --- a/xarray/tests/test_interp.py +++ b/xarray/tests/test_interp.py @@ -16,6 +16,7 @@ assert_identical, has_dask, has_scipy, + has_scipy_ge_1_13, requires_cftime, requires_dask, requires_scipy, @@ -137,8 +138,16 @@ def func(obj, new_x): ( (False, "linear"), (False, "akima"), - (False, "makima"), - (True, "linear"), + pytest.param( + False, + "makima", + marks=pytest.mark.skipif(not has_scipy_ge_1_13, reason="scipy too old"), + ), + pytest.param( + True, + "linear", + marks=pytest.mark.skipif(not has_dask, reason="dask not available"), + ), (True, "akima"), ), ) @@ -146,9 +155,6 @@ def test_interpolate_vectorize(use_dask: bool, method: str) -> None: if not has_scipy: pytest.skip("scipy is not installed.") - if not has_dask and use_dask: - pytest.skip("dask is not installed in the environment.") - # scipy interpolation for the reference def func(obj, dim, new_x, method): scipy_kwargs = {}