|
6 | 6 | da = pytest.importorskip('dask.array')
|
7 | 7 | from distributed.utils_test import cluster, loop
|
8 | 8 |
|
9 |
| -from xarray.tests.test_backends import create_tmp_file |
| 9 | +from xarray.tests.test_backends import create_tmp_file, ON_WINDOWS |
10 | 10 | from xarray.tests.test_dataset import create_test_data
|
11 | 11 |
|
12 | 12 | from . import assert_allclose, has_scipy, has_netCDF4, has_h5netcdf
|
|
24 | 24 | @pytest.mark.parametrize('engine', ENGINES)
|
25 | 25 | def test_dask_distributed_integration_test(loop, engine):
|
26 | 26 | with cluster() as (s, _):
|
27 |
| - with distributed.Client(('127.0.0.1', s['port']), loop=loop): |
| 27 | + with distributed.Client(s['address'], loop=loop): |
28 | 28 | original = create_test_data()
|
29 |
| - with create_tmp_file() as filename: |
| 29 | + with create_tmp_file(allow_cleanup_failure=ON_WINDOWS) as filename: |
30 | 30 | original.to_netcdf(filename, engine=engine)
|
31 |
| - restored = xr.open_dataset(filename, chunks=3, engine=engine) |
32 |
| - assert isinstance(restored.var1.data, da.Array) |
33 |
| - computed = restored.compute() |
34 |
| - assert_allclose(original, computed) |
| 31 | + with xr.open_dataset(filename, chunks=3, engine=engine) as restored: |
| 32 | + assert isinstance(restored.var1.data, da.Array) |
| 33 | + computed = restored.compute() |
| 34 | + assert_allclose(original, computed) |
0 commit comments