From 7b6a1b68b516e33ded6131fb931a1e08b832f040 Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Wed, 4 Oct 2017 16:34:44 -0700 Subject: [PATCH 1/5] Fix the test suite on dask 0.15.3 --- xarray/tests/test_dask.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xarray/tests/test_dask.py b/xarray/tests/test_dask.py index fdb2ff715dd..c77df6e8cac 100644 --- a/xarray/tests/test_dask.py +++ b/xarray/tests/test_dask.py @@ -4,6 +4,8 @@ import pickle from textwrap import dedent + +from distutils.version import LooseVersion import numpy as np import pandas as pd import pytest @@ -252,6 +254,10 @@ def test_lazy_array(self): self.assertLazyAndAllClose(u, actual) def test_groupby(self): + if LooseVersion(dask.__version__) == LooseVersion('0.15.3'): + pytest.xfail('upstream bug in dask: ' + 'https://github.com/dask/dask/issues/2718') + u = self.eager_array v = self.lazy_array From 54c1c87f9ee78b2576eb8815ef5c45b26f6fa6ef Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Wed, 4 Oct 2017 18:51:03 -0700 Subject: [PATCH 2/5] Try conda-forge for requirements-py27-min --- ci/requirements-py27-min.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/requirements-py27-min.yml b/ci/requirements-py27-min.yml index 6f63315db67..615e708bf6d 100644 --- a/ci/requirements-py27-min.yml +++ b/ci/requirements-py27-min.yml @@ -1,4 +1,6 @@ name: test_env +channels: + - conda-forge dependencies: - python=2.7 - pytest From bd3eb9668a4b0b62c807ba3fbc400d727f33789e Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Thu, 5 Oct 2017 08:17:20 -0700 Subject: [PATCH 3/5] try moving requires_dask --- xarray/tests/test_dask.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xarray/tests/test_dask.py b/xarray/tests/test_dask.py index c77df6e8cac..f3be2294e48 100644 --- a/xarray/tests/test_dask.py +++ b/xarray/tests/test_dask.py @@ -479,8 +479,8 @@ def test_from_dask_variable(self): self.assertLazyAndIdentical(self.lazy_array, a) -@requires_dask @pytest.mark.parametrize("method", ['load', 'compute']) +@requires_dask def test_dask_kwargs_variable(method): x = Variable('y', da.from_array(np.arange(3), chunks=(2,))) # args should be passed on to da.Array.compute() @@ -490,8 +490,8 @@ def test_dask_kwargs_variable(method): mock_compute.assert_called_with(foo='bar') -@requires_dask @pytest.mark.parametrize("method", ['load', 'compute', 'persist']) +@requires_dask def test_dask_kwargs_dataarray(method): data = da.from_array(np.arange(3), chunks=(2,)) x = DataArray(data) @@ -505,8 +505,8 @@ def test_dask_kwargs_dataarray(method): mock_func.assert_called_with(data, foo='bar') -@requires_dask @pytest.mark.parametrize("method", ['load', 'compute', 'persist']) +@requires_dask def test_dask_kwargs_dataset(method): data = da.from_array(np.arange(3), chunks=(2,)) x = Dataset({'x': (('y'), data)}) From 6d0fdd63613e5a1510e239428725a33cda19f819 Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Thu, 5 Oct 2017 08:25:33 -0700 Subject: [PATCH 4/5] alternative dask skipping --- xarray/tests/test_dask.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/xarray/tests/test_dask.py b/xarray/tests/test_dask.py index f3be2294e48..1dfba9e0b53 100644 --- a/xarray/tests/test_dask.py +++ b/xarray/tests/test_dask.py @@ -14,13 +14,12 @@ from xarray import Variable, DataArray, Dataset import xarray.ufuncs as xu from xarray.core.pycompat import suppress -from . import TestCase, requires_dask +from . import TestCase from xarray.tests import mock -with suppress(ImportError): - import dask - import dask.array as da +dask = pytest.importerskip('dask') +import dask.array as da class DaskTestCase(TestCase): @@ -46,7 +45,6 @@ def assertLazyAnd(self, expected, actual, test): assert False -@requires_dask class TestVariable(DaskTestCase): def assertLazyAndIdentical(self, expected, actual): self.assertLazyAnd(expected, actual, self.assertVariableIdentical) @@ -208,7 +206,6 @@ def test_bivariate_ufunc(self): self.assertLazyAndAllClose(np.maximum(u, 0), xu.maximum(0, v)) -@requires_dask class TestDataArrayAndDataset(DaskTestCase): def assertLazyAndIdentical(self, expected, actual): self.assertLazyAnd(expected, actual, self.assertDataArrayIdentical) @@ -480,7 +477,6 @@ def test_from_dask_variable(self): @pytest.mark.parametrize("method", ['load', 'compute']) -@requires_dask def test_dask_kwargs_variable(method): x = Variable('y', da.from_array(np.arange(3), chunks=(2,))) # args should be passed on to da.Array.compute() @@ -491,7 +487,6 @@ def test_dask_kwargs_variable(method): @pytest.mark.parametrize("method", ['load', 'compute', 'persist']) -@requires_dask def test_dask_kwargs_dataarray(method): data = da.from_array(np.arange(3), chunks=(2,)) x = DataArray(data) @@ -506,7 +501,6 @@ def test_dask_kwargs_dataarray(method): @pytest.mark.parametrize("method", ['load', 'compute', 'persist']) -@requires_dask def test_dask_kwargs_dataset(method): data = da.from_array(np.arange(3), chunks=(2,)) x = Dataset({'x': (('y'), data)}) From ff72c9e73fccf2435b36b18d2b86d6c2bb57099a Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Thu, 5 Oct 2017 09:20:04 -0700 Subject: [PATCH 5/5] spelling --- ci/requirements-py27-min.yml | 2 -- xarray/tests/test_dask.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ci/requirements-py27-min.yml b/ci/requirements-py27-min.yml index 615e708bf6d..6f63315db67 100644 --- a/ci/requirements-py27-min.yml +++ b/ci/requirements-py27-min.yml @@ -1,6 +1,4 @@ name: test_env -channels: - - conda-forge dependencies: - python=2.7 - pytest diff --git a/xarray/tests/test_dask.py b/xarray/tests/test_dask.py index 1dfba9e0b53..0244c7ec8af 100644 --- a/xarray/tests/test_dask.py +++ b/xarray/tests/test_dask.py @@ -18,7 +18,7 @@ from xarray.tests import mock -dask = pytest.importerskip('dask') +dask = pytest.importorskip('dask') import dask.array as da