From f252ef5e5b162759d1be271a6de312a2f68fafbb Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Jul 2021 17:38:28 -0400 Subject: [PATCH] Backport fixes to tests. --- ...t-download-RGB.byte.tif-during-build.patch | 6 +-- ...amples-using-unpackaged-dependencies.patch | 10 ++--- ...on-t-print-out-conda-pip-environment.patch | 39 +++++++++++++++++++ 0004-Fix-type-inference-for-dask-push.patch | 30 ++++++++++++++ ...sk-meta-and-output_dtypes-error-5449.patch | 29 ++++++++++++++ python-xarray.spec | 14 ++++--- 6 files changed, 115 insertions(+), 13 deletions(-) create mode 100644 0003-DOC-Don-t-print-out-conda-pip-environment.patch create mode 100644 0004-Fix-type-inference-for-dask-push.patch create mode 100644 0005-fix-dask-meta-and-output_dtypes-error-5449.patch diff --git a/0001-DOC-Don-t-download-RGB.byte.tif-during-build.patch b/0001-DOC-Don-t-download-RGB.byte.tif-during-build.patch index 5b31908..a428025 100644 --- a/0001-DOC-Don-t-download-RGB.byte.tif-during-build.patch +++ b/0001-DOC-Don-t-download-RGB.byte.tif-during-build.patch @@ -1,7 +1,7 @@ -From d1bff712ac7f0d65d943c77de7008fd192eae919 Mon Sep 17 00:00:00 2001 +From ae6e4b42276425bd74c358b21c6ca0d6cd19b902 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 15 Mar 2019 22:31:18 -0400 -Subject: [PATCH 1/4] DOC: Don't download RGB.byte.tif during build. +Subject: [PATCH 1/5] DOC: Don't download RGB.byte.tif during build. Signed-off-by: Elliott Sales de Andrade --- @@ -36,5 +36,5 @@ index 758d4cd3..f2a7b2db 100644 # The data is in UTM projection. We have to set it manually until -- -2.29.2 +2.31.1 diff --git a/0002-DOC-Skip-examples-using-unpackaged-dependencies.patch b/0002-DOC-Skip-examples-using-unpackaged-dependencies.patch index 3a9be3c..098350e 100644 --- a/0002-DOC-Skip-examples-using-unpackaged-dependencies.patch +++ b/0002-DOC-Skip-examples-using-unpackaged-dependencies.patch @@ -1,15 +1,15 @@ -From 98140b3ff72134777959896d128e5049c182eaa7 Mon Sep 17 00:00:00 2001 +From 22ee1f210910d8ab50cf45ff1b1ef54e30ff4dca Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 15 Mar 2019 22:48:25 -0400 -Subject: [PATCH 2/4] DOC: Skip examples using unpackaged dependencies. +Subject: [PATCH 2/5] DOC: Skip examples using unpackaged dependencies. Signed-off-by: Elliott Sales de Andrade --- - doc/io.rst | 2 ++ + doc/user-guide/io.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/user-guide/io.rst b/doc/user-guide/io.rst -index c2022cc9..fb9cba9c 100644 +index 8038beac..4b73d27f 100644 --- a/doc/user-guide/io.rst +++ b/doc/user-guide/io.rst @@ -510,6 +510,7 @@ installed, xarray can convert a ``DataArray`` into a ``Cube`` using @@ -29,5 +29,5 @@ index c2022cc9..fb9cba9c 100644 da_cube = xr.DataArray.from_iris(cube) da_cube -- -2.29.2 +2.31.1 diff --git a/0003-DOC-Don-t-print-out-conda-pip-environment.patch b/0003-DOC-Don-t-print-out-conda-pip-environment.patch new file mode 100644 index 0000000..6050c89 --- /dev/null +++ b/0003-DOC-Don-t-print-out-conda-pip-environment.patch @@ -0,0 +1,39 @@ +From b515f4289c5c65b8c2f1dfd8039a7a326db2580f Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Sat, 16 Mar 2019 02:59:15 -0400 +Subject: [PATCH 3/5] DOC: Don't print out conda/pip environment. + +Signed-off-by: Elliott Sales de Andrade +--- + doc/conf.py | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/doc/conf.py b/doc/conf.py +index 7e7c63ca..31a45020 100644 +--- a/doc/conf.py ++++ b/doc/conf.py +@@ -15,7 +15,6 @@ + import datetime + import inspect + import os +-import subprocess + import sys + from contextlib import suppress + +@@ -28,13 +27,6 @@ allowed_failures = set() + print("python exec:", sys.executable) + print("sys.path:", sys.path) + +-if "conda" in sys.executable: +- print("conda environment:") +- subprocess.run(["conda", "list"]) +-else: +- print("pip environment:") +- subprocess.run([sys.executable, "-m", "pip", "list"]) +- + print(f"xarray: {xarray.__version__}, {xarray.__file__}") + + with suppress(ImportError): +-- +2.31.1 + diff --git a/0004-Fix-type-inference-for-dask-push.patch b/0004-Fix-type-inference-for-dask-push.patch new file mode 100644 index 0000000..da071b9 --- /dev/null +++ b/0004-Fix-type-inference-for-dask-push.patch @@ -0,0 +1,30 @@ +From c15aabe93e8468ac7561bbdcc2a1a2898bc07d83 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Thu, 20 May 2021 02:40:23 -0400 +Subject: [PATCH 4/5] Fix type inference for dask push. + +Signed-off-by: Elliott Sales de Andrade +--- + xarray/core/dask_array_ops.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/xarray/core/dask_array_ops.py b/xarray/core/dask_array_ops.py +index 87f67028..0bd2cece 100644 +--- a/xarray/core/dask_array_ops.py ++++ b/xarray/core/dask_array_ops.py +@@ -66,9 +66,10 @@ def push(array, n, axis): + ) + if all(c == 1 for c in array.chunks[axis]): + array = array.rechunk({axis: 2}) +- pushed = array.map_blocks(push, axis=axis, n=n) ++ pushed = array.map_blocks(push, axis=axis, n=n, dtype=array.dtype, meta=array._meta) + if len(array.chunks[axis]) > 1: + pushed = pushed.map_overlap( +- push, axis=axis, n=n, depth={axis: (1, 0)}, boundary="none" ++ push, axis=axis, n=n, depth={axis: (1, 0)}, boundary="none", ++ dtype=array.dtype, meta=array._meta + ) + return pushed +-- +2.31.1 + diff --git a/0005-fix-dask-meta-and-output_dtypes-error-5449.patch b/0005-fix-dask-meta-and-output_dtypes-error-5449.patch new file mode 100644 index 0000000..769352c --- /dev/null +++ b/0005-fix-dask-meta-and-output_dtypes-error-5449.patch @@ -0,0 +1,29 @@ +From 5dfe10420c28fac4a382b17a6993211373286b50 Mon Sep 17 00:00:00 2001 +From: Mathias Hauser +Date: Mon, 7 Jun 2021 23:05:24 +0200 +Subject: [PATCH 5/5] fix dask meta and output_dtypes error (#5449) + +Signed-off-by: Elliott Sales de Andrade +--- + xarray/tests/test_computation.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/xarray/tests/test_computation.py b/xarray/tests/test_computation.py +index cbfa61a4..2d2e019d 100644 +--- a/xarray/tests/test_computation.py ++++ b/xarray/tests/test_computation.py +@@ -1306,7 +1306,10 @@ def test_vectorize_dask_dtype_without_output_dtypes(data_array): + assert expected.dtype == actual.dtype + + +-@pytest.mark.xfail(LooseVersion(dask.__version__) < "2.3", reason="dask GH5274") ++@pytest.mark.skipif( ++ LooseVersion(dask.__version__) > "2021.06", ++ reason="dask/dask#7669: can no longer pass output_dtypes and meta", ++) + @requires_dask + def test_vectorize_dask_dtype_meta(): + # meta dtype takes precedence +-- +2.31.1 + diff --git a/python-xarray.spec b/python-xarray.spec index 8068bc0..70b1b8f 100644 --- a/python-xarray.spec +++ b/python-xarray.spec @@ -5,7 +5,7 @@ Name: python-%{srcname} Version: 0.18.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: N-D labeled arrays and datasets in Python License: ASL 2.0 @@ -17,6 +17,11 @@ Source2: https://github.com/mapbox/rasterio/raw/1.0.21/tests/data/RGB.byt # All Fedora specific. Patch0001: 0001-DOC-Don-t-download-RGB.byte.tif-during-build.patch Patch0002: 0002-DOC-Skip-examples-using-unpackaged-dependencies.patch +Patch0003: 0003-DOC-Don-t-print-out-conda-pip-environment.patch +# https://github.com/pydata/xarray/pull/5574 +Patch0004: 0004-Fix-type-inference-for-dask-push.patch +# https://github.com/pydata/xarray/pull/5574 +Patch0005: 0005-fix-dask-meta-and-output_dtypes-error-5449.patch BuildArch: noarch @@ -114,10 +119,6 @@ rm -rf xarray pytest_args=( -n auto -m "not network" - - # FIXME: skip failing tests - --deselect=tests/test_backends.py::test_no_warning_from_dask_effective_get - --deselect=tests/test_computation.py::test_vectorize_dask_dtype_meta ) %{pytest} -ra "${pytest_args[@]}" --pyargs xarray @@ -137,6 +138,9 @@ pytest_args=( %changelog +* Sun Jul 04 2021 Elliott Sales de Andrade - 0.18.2-2 +- Backport fixes to tests + * Thu Jun 17 2021 Zbigniew Jędrzejewski-Szmek - 0.18.2-1 - Update to latest version (#1957925) - Skip failing tests (#1969172)