@@ -4838,15 +4838,18 @@ def test_open_dataset_chunking_zarr(chunks, tmp_path):
4838
4838
4839
4839
with dask .config .set ({"array.chunk-size" : "1MiB" }):
4840
4840
expected = ds .chunk (chunks )
4841
- actual = xr .open_dataset (tmp_path / "test.zarr" , engine = "zarr" , chunks = chunks )
4842
- xr .testing .assert_chunks_equal (actual , expected )
4841
+ with open_dataset (
4842
+ tmp_path / "test.zarr" , engine = "zarr" , chunks = chunks
4843
+ ) as actual :
4844
+ xr .testing .assert_chunks_equal (actual , expected )
4843
4845
4844
4846
4845
4847
@requires_zarr
4846
4848
@requires_dask
4847
4849
@pytest .mark .parametrize (
4848
4850
"chunks" , ["auto" , - 1 , {}, {"x" : "auto" }, {"x" : - 1 }, {"x" : "auto" , "y" : - 1 }]
4849
4851
)
4852
+ @pytest .mark .filterwarnings ("ignore:Specified Dask chunks" )
4850
4853
def test_chunking_consintency (chunks , tmp_path ):
4851
4854
encoded_chunks = {}
4852
4855
dask_arr = da .from_array (
@@ -4866,8 +4869,10 @@ def test_chunking_consintency(chunks, tmp_path):
4866
4869
4867
4870
with dask .config .set ({"array.chunk-size" : "1MiB" }):
4868
4871
expected = ds .chunk (chunks )
4869
- actual = xr .open_dataset (tmp_path / "test.zarr" , engine = "zarr" , chunks = chunks )
4870
- xr .testing .assert_chunks_equal (actual , expected )
4872
+ with xr .open_dataset (
4873
+ tmp_path / "test.zarr" , engine = "zarr" , chunks = chunks
4874
+ ) as actual :
4875
+ xr .testing .assert_chunks_equal (actual , expected )
4871
4876
4872
- actual = xr .open_dataset (tmp_path / "test.nc" , chunks = chunks )
4873
- xr .testing .assert_chunks_equal (actual , expected )
4877
+ with xr .open_dataset (tmp_path / "test.nc" , chunks = chunks ) as actual :
4878
+ xr .testing .assert_chunks_equal (actual , expected )
0 commit comments