File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 [:]
You can’t perform that action at this time.
0 commit comments