11
11
import xarray .testing as xrt
12
12
from xarray .tests import has_zarr_v3 , requires_zarr_v3
13
13
14
+
14
15
if has_zarr_v3 :
15
16
import zarr
16
17
from zarr .abc .store import ByteRequest , Store
@@ -146,20 +147,6 @@ def assert_time_as_expected(
146
147
abs (total_time - latency ) < 2.0
147
148
) # Should take approximately `latency` seconds, but allow some buffer
148
149
149
- async def test_concurrent_load_multiple_objects (self , xr_obj ) -> None :
150
- N_OBJECTS = 5
151
-
152
- async with AsyncTimer ().measure () as timer :
153
- tasks = [xr_obj .load_async () for _ in range (N_OBJECTS )]
154
- results = await asyncio .gather (* tasks )
155
-
156
- for result in results :
157
- xrt .assert_identical (result , xr_obj .load ())
158
-
159
- self .assert_time_as_expected (
160
- total_time = timer .total_time , latency = self .LATENCY , n_loads = N_OBJECTS
161
- )
162
-
163
150
async def test_concurrent_load_multiple_variables (self , memorystore ) -> None :
164
151
latencystore = LatencyStore (memorystore , latency = self .LATENCY )
165
152
ds = xr .open_zarr (latencystore , zarr_format = 3 , consolidated = False , chunks = None )
@@ -174,3 +161,17 @@ async def test_concurrent_load_multiple_variables(self, memorystore) -> None:
174
161
self .assert_time_as_expected (
175
162
total_time = timer .total_time , latency = self .LATENCY , n_loads = 2
176
163
)
164
+
165
+ async def test_concurrent_load_multiple_objects (self , xr_obj ) -> None :
166
+ N_OBJECTS = 5
167
+
168
+ async with AsyncTimer ().measure () as timer :
169
+ coros = [xr_obj .load_async () for _ in range (N_OBJECTS )]
170
+ results = await asyncio .gather (* coros )
171
+
172
+ for result in results :
173
+ xrt .assert_identical (result , xr_obj .load ())
174
+
175
+ self .assert_time_as_expected (
176
+ total_time = timer .total_time , latency = self .LATENCY , n_loads = N_OBJECTS
177
+ )
0 commit comments