Skip to content

Commit

Permalink
add distributed integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Hamman committed May 15, 2018
1 parent 99c9661 commit 55a3abc
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions xarray/tests/test_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
from distributed.client import futures_of

import xarray as xr
from xarray.tests.test_backends import ON_WINDOWS, create_tmp_file
from xarray.tests.test_backends import (ON_WINDOWS, create_tmp_file,
create_tmp_geotiff)
from xarray.tests.test_dataset import create_test_data
from xarray.backends.common import HDF5_LOCK, CombinedLock

from . import (
assert_allclose, has_h5netcdf, has_netCDF4, has_scipy, requires_zarr,
raises_regex)
assert_allclose, has_h5netcdf, has_netCDF4, requires_rasterio, has_scipy,
requires_zarr, raises_regex)

# this is to stop isort throwing errors. May have been easier to just use
# `isort:skip` in retrospect
Expand Down Expand Up @@ -136,6 +137,17 @@ def test_dask_distributed_zarr_integration_test(loop):
assert_allclose(original, computed)


@requires_rasterio
def test_dask_distributed_rasterio_integration_test(loop):
with create_tmp_geotiff() as (tmp_file, expected):
with cluster() as (s, [a, b]):
with Client(s['address'], loop=loop) as c:
da_tiff = xr.open_rasterio(tmp_file, chunks={'band': 1})
assert isinstance(da_tiff.data, da.Array)
actual = da_tiff.compute()
assert_allclose(actual, expected)


@pytest.mark.skipif(distributed.__version__ <= '1.19.3',
reason='Need recent distributed version to clean up get')
@gen_cluster(client=True, timeout=None)
Expand Down

0 comments on commit 55a3abc

Please sign in to comment.