Skip to content

Fix the test suite on dask 0.15.3 #1610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions xarray/tests/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -12,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.importorskip('dask')
import dask.array as da


class DaskTestCase(TestCase):
Expand All @@ -44,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)
Expand Down Expand Up @@ -206,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)
Expand Down Expand Up @@ -252,6 +251,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

Expand Down Expand Up @@ -473,7 +476,6 @@ def test_from_dask_variable(self):
self.assertLazyAndIdentical(self.lazy_array, a)


@requires_dask
@pytest.mark.parametrize("method", ['load', 'compute'])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhamman For future reference, it looks like pytest.mark.parametrize doesn't play well with the unittest based skiptest decorator. So I switched the import check to use something different for this module, but it's something we'll have to watch out for in the future, too.

def test_dask_kwargs_variable(method):
x = Variable('y', da.from_array(np.arange(3), chunks=(2,)))
Expand All @@ -484,7 +486,6 @@ def test_dask_kwargs_variable(method):
mock_compute.assert_called_with(foo='bar')


@requires_dask
@pytest.mark.parametrize("method", ['load', 'compute', 'persist'])
def test_dask_kwargs_dataarray(method):
data = da.from_array(np.arange(3), chunks=(2,))
Expand All @@ -499,7 +500,6 @@ def test_dask_kwargs_dataarray(method):
mock_func.assert_called_with(data, foo='bar')


@requires_dask
@pytest.mark.parametrize("method", ['load', 'compute', 'persist'])
def test_dask_kwargs_dataset(method):
data = da.from_array(np.arange(3), chunks=(2,))
Expand Down