Skip to content

Commit 55a3abc

Browse files
author
Joseph Hamman
committed
add distributed integration test
1 parent 99c9661 commit 55a3abc

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

xarray/tests/test_distributed.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
from distributed.client import futures_of
1818

1919
import xarray as xr
20-
from xarray.tests.test_backends import ON_WINDOWS, create_tmp_file
20+
from xarray.tests.test_backends import (ON_WINDOWS, create_tmp_file,
21+
create_tmp_geotiff)
2122
from xarray.tests.test_dataset import create_test_data
2223
from xarray.backends.common import HDF5_LOCK, CombinedLock
2324

2425
from . import (
25-
assert_allclose, has_h5netcdf, has_netCDF4, has_scipy, requires_zarr,
26-
raises_regex)
26+
assert_allclose, has_h5netcdf, has_netCDF4, requires_rasterio, has_scipy,
27+
requires_zarr, raises_regex)
2728

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

138139

140+
@requires_rasterio
141+
def test_dask_distributed_rasterio_integration_test(loop):
142+
with create_tmp_geotiff() as (tmp_file, expected):
143+
with cluster() as (s, [a, b]):
144+
with Client(s['address'], loop=loop) as c:
145+
da_tiff = xr.open_rasterio(tmp_file, chunks={'band': 1})
146+
assert isinstance(da_tiff.data, da.Array)
147+
actual = da_tiff.compute()
148+
assert_allclose(actual, expected)
149+
150+
139151
@pytest.mark.skipif(distributed.__version__ <= '1.19.3',
140152
reason='Need recent distributed version to clean up get')
141153
@gen_cluster(client=True, timeout=None)

0 commit comments

Comments
 (0)