Skip to content

Commit eb50521

Browse files
committed
test fixup
1 parent 83c53b0 commit eb50521

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_codecs/test_nvcomp.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,19 @@ def gpu_context() -> Iterator[None]:
8383
write_data = np.arange(16, dtype="int32").reshape(4, 4)
8484
read_data = cp.array(write_data)
8585
xp = cp
86+
# MemoryStore holds Buffers; We write a CPU buffer, but read a GPU buffer
87+
# which emits a warning.
88+
expected_warning: pytest.WarningsRecorder | contextlib.AbstractContextManager[None] = (
89+
pytest.warns(zarr.errors.ZarrUserWarning)
90+
)
8691
else:
8792
# GPU encode, CPU decode
8893
write_ctx = gpu_context()
8994
read_ctx = contextlib.nullcontext()
9095
write_data = cp.arange(16, dtype="int32").reshape(4, 4)
9196
read_data = write_data.get()
9297
xp = np
98+
expected_warning = contextlib.nullcontext()
9399

94100
store = zarr.storage.MemoryStore()
95101

@@ -102,7 +108,7 @@ def gpu_context() -> Iterator[None]:
102108
)
103109
z[:] = write_data
104110

105-
with read_ctx:
111+
with read_ctx, expected_warning:
106112
# We need to reopen z, because `z.codec_pipeline` is set at creation
107113
z = zarr.open_array(store=store, mode="r")
108114
result = z[:]

0 commit comments

Comments
 (0)