Skip to content

Commit 37700a5

Browse files
committed
fix for tests
1 parent 8c37d5d commit 37700a5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

numcodecs/tests/test_zarr3.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import pytest
77
import sys
88

9+
from numcodecs.registry import get_codec
10+
911
try:
1012
from zarr.codecs.registry import get_codec_class
1113
from zarr.array import Array
@@ -178,17 +180,16 @@ def test_generic_checksum(store: Store, codec_id: str):
178180

179181
@pytest.mark.parametrize("codec_id", ["pcodec", "zfpy"])
180182
def test_generic_bytes_codec(store: Store, codec_id: str):
181-
data = np.arange(0, 256, dtype="float32").reshape((16, 16))
182-
183183
try:
184-
codec_class = get_codec_class(f"numcodecs.{codec_id}")
184+
get_codec({"id": codec_id})
185185
except ValueError as e:
186-
# zfpy is not available on all platforms and versions
187186
if "codec not available" in str(e):
188-
return
187+
pytest.xfail(f"{codec_id} is not available")
189188
else:
190189
raise
191190

191+
data = np.arange(0, 256, dtype="float32").reshape((16, 16))
192+
192193
with pytest.warns(UserWarning, match="Numcodecs.*"):
193194
a = Array.create(
194195
store / "generic",
@@ -197,7 +198,7 @@ def test_generic_bytes_codec(store: Store, codec_id: str):
197198
dtype=data.dtype,
198199
fill_value=0,
199200
codecs=[
200-
codec_class({"id": codec_id}),
201+
get_codec_class(f"numcodecs.{codec_id}")({"id": codec_id}),
201202
],
202203
)
203204

0 commit comments

Comments
 (0)