Skip to content

Commit 6d96ad7

Browse files
committed
add sharding to multiprocessing test
1 parent 9d97b24 commit 6d96ad7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/test_array.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,12 +1794,19 @@ def _index_array(arr: Array, index: Any) -> Any:
17941794
],
17951795
)
17961796
@pytest.mark.parametrize("store", ["local"], indirect=True)
1797-
def test_multiprocessing(store: Store, method: Literal["fork", "spawn", "forkserver"]) -> None:
1797+
@pytest.mark.parametrize("shards", [None, (20,)])
1798+
def test_multiprocessing(
1799+
store: Store, method: Literal["fork", "spawn", "forkserver"], shards: tuple[int, ...] | None
1800+
) -> None:
17981801
"""
17991802
Test that arrays can be pickled and indexed in child processes
18001803
"""
18011804
data = np.arange(100)
1802-
arr = zarr.create_array(store=store, data=data)
1805+
if shards is None:
1806+
chunks = "auto"
1807+
else:
1808+
chunks = (1,)
1809+
arr = zarr.create_array(store=store, data=data, shards=shards, chunks=chunks)
18031810
ctx = mp.get_context(method)
18041811
with ctx.Pool() as pool:
18051812
results = pool.starmap(_index_array, [(arr, slice(len(data)))])

0 commit comments

Comments
 (0)