File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -83,13 +83,19 @@ def gpu_context() -> Iterator[None]:
83
83
write_data = np .arange (16 , dtype = "int32" ).reshape (4 , 4 )
84
84
read_data = cp .array (write_data )
85
85
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
+ )
86
91
else :
87
92
# GPU encode, CPU decode
88
93
write_ctx = gpu_context ()
89
94
read_ctx = contextlib .nullcontext ()
90
95
write_data = cp .arange (16 , dtype = "int32" ).reshape (4 , 4 )
91
96
read_data = write_data .get ()
92
97
xp = np
98
+ expected_warning = contextlib .nullcontext ()
93
99
94
100
store = zarr .storage .MemoryStore ()
95
101
@@ -102,7 +108,7 @@ def gpu_context() -> Iterator[None]:
102
108
)
103
109
z [:] = write_data
104
110
105
- with read_ctx :
111
+ with read_ctx , expected_warning :
106
112
# We need to reopen z, because `z.codec_pipeline` is set at creation
107
113
z = zarr .open_array (store = store , mode = "r" )
108
114
result = z [:]
You can’t perform that action at this time.
0 commit comments