From aa3554471ee4c5d66a74e9092bb246e815d1daf8 Mon Sep 17 00:00:00 2001 From: Hendrik Makait Date: Mon, 6 Jan 2025 15:53:16 +0100 Subject: [PATCH 1/2] Skip big-endian floats if using scipy>=1.15.0 Origin: https://github.com/dask/distributed/pull/8977 Bug: https://github.com/scipy/scipy/issues/22258 --- distributed/protocol/tests/test_scipy.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/distributed/protocol/tests/test_scipy.py b/distributed/protocol/tests/test_scipy.py index 8bea435d5e5..84f34fd469f 100644 --- a/distributed/protocol/tests/test_scipy.py +++ b/distributed/protocol/tests/test_scipy.py @@ -1,4 +1,5 @@ from __future__ import annotations +from packaging.version import Version import pytest @@ -9,6 +10,9 @@ scipy_sparse = pytest.importorskip("scipy.sparse") +SCIPY_VERSION = Version(scipy.__version__) +SCIPY_GE_1_15_0 = SCIPY_VERSION.release >= (1, 15, 0) + @pytest.mark.parametrize( "sparse_type", [ @@ -23,7 +27,12 @@ ) @pytest.mark.parametrize( "dtype", - [numpy.dtype("f4"), numpy.dtype("f8")], + [ + numpy.dtype("f4"), marks=pytest.mark.skipif(SCIPY_GE_1_15_0, reason="https://github.com/scipy/scipy/issues/22258")), + numpy.dtype("f8"), marks=pytest.mark.skipif(SCIPY_GE_1_15_0, reason="https://github.com/scipy/scipy/issues/22258")), + ], ) def test_serialize_scipy_sparse(sparse_type, dtype): a = numpy.array([[0, 1, 0], [2, 0, 3], [0, 4, 0]], dtype=dtype) From 2ff8deddc594a2891cdcbd9d7fe3496d91465ed0 Mon Sep 17 00:00:00 2001 From: Hendrik Makait Date: Mon, 6 Jan 2025 15:58:40 +0100 Subject: [PATCH 2/2] linting --- distributed/protocol/tests/test_scipy.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/distributed/protocol/tests/test_scipy.py b/distributed/protocol/tests/test_scipy.py index 84f34fd469f..cbbfa41c072 100644 --- a/distributed/protocol/tests/test_scipy.py +++ b/distributed/protocol/tests/test_scipy.py @@ -1,7 +1,7 @@ from __future__ import annotations -from packaging.version import Version import pytest +from packaging.version import Version from distributed.protocol import deserialize, serialize @@ -13,6 +13,7 @@ SCIPY_VERSION = Version(scipy.__version__) SCIPY_GE_1_15_0 = SCIPY_VERSION.release >= (1, 15, 0) + @pytest.mark.parametrize( "sparse_type", [ @@ -28,10 +29,20 @@ @pytest.mark.parametrize( "dtype", [ - numpy.dtype("f4"), marks=pytest.mark.skipif(SCIPY_GE_1_15_0, reason="https://github.com/scipy/scipy/issues/22258")), + numpy.dtype("f4"), + marks=pytest.mark.skipif( + SCIPY_GE_1_15_0, reason="https://github.com/scipy/scipy/issues/22258" + ), + ), numpy.dtype("f8"), marks=pytest.mark.skipif(SCIPY_GE_1_15_0, reason="https://github.com/scipy/scipy/issues/22258")), + pytest.param( + numpy.dtype(">f8"), + marks=pytest.mark.skipif( + SCIPY_GE_1_15_0, reason="https://github.com/scipy/scipy/issues/22258" + ), + ), ], ) def test_serialize_scipy_sparse(sparse_type, dtype):