Skip to content

Commit 7ace74a

Browse files
committed
Close pool in multiprocessing test
1 parent 4bb6318 commit 7ace74a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tests/test_array.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,9 +1422,8 @@ def test_multiprocessing(store: Store, method: Literal["fork", "spawn", "forkser
14221422
data = np.arange(100)
14231423
arr = zarr.create_array(store=store, data=data)
14241424
ctx = mp.get_context(method)
1425-
pool = ctx.Pool()
1426-
1427-
results = pool.starmap(_index_array, [(arr, slice(len(data)))])
1425+
with ctx.Pool() as pool:
1426+
results = pool.starmap(_index_array, [(arr, slice(len(data)))])
14281427
assert all(np.array_equal(r, data) for r in results)
14291428

14301429

0 commit comments

Comments
 (0)