Skip to content

Commit 1546d93

Browse files
authored
Fix Blosc import in test for zarr 3.1.13 (#10756)
1 parent 8694818 commit 1546d93

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

xarray/tests/test_backends_datatree.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,9 +678,10 @@ def test_zarr_encoding(self, tmpdir, simple_datatree, zarr_format) -> None:
678678
comp = {"compressors": (codec,)} if has_zarr_v3 else {"compressor": codec}
679679
elif zarr_format == 3:
680680
# specifying codecs in zarr_format=3 requires importing from zarr 3 namespace
681-
import numcodecs.zarr3
681+
from zarr.registry import get_codec_class
682682

683-
comp = {"compressors": (numcodecs.zarr3.Blosc(cname="zstd", clevel=3),)}
683+
Blosc = get_codec_class("numcodecs.blosc")
684+
comp = {"compressors": (Blosc(cname="zstd", clevel=3),)} # type: ignore[call-arg]
684685

685686
enc = {"/set2": dict.fromkeys(original_dt["/set2"].dataset.data_vars, comp)}
686687
original_dt.to_zarr(filepath, encoding=enc, zarr_format=zarr_format)

0 commit comments

Comments
 (0)