From 6d96ad762635d3f3ddb56bef6fe2efda9caa3127 Mon Sep 17 00:00:00 2001 From: Ziwen Liu <67518483+ziw-liu@users.noreply.github.com> Date: Wed, 9 Jul 2025 18:00:23 -0700 Subject: [PATCH 1/2] add sharding to multiprocessing test --- tests/test_array.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/test_array.py b/tests/test_array.py index 0bca860e84..fb09b9bc44 100644 --- a/tests/test_array.py +++ b/tests/test_array.py @@ -1794,12 +1794,19 @@ def _index_array(arr: Array, index: Any) -> Any: ], ) @pytest.mark.parametrize("store", ["local"], indirect=True) -def test_multiprocessing(store: Store, method: Literal["fork", "spawn", "forkserver"]) -> None: +@pytest.mark.parametrize("shards", [None, (20,)]) +def test_multiprocessing( + store: Store, method: Literal["fork", "spawn", "forkserver"], shards: tuple[int, ...] | None +) -> None: """ Test that arrays can be pickled and indexed in child processes """ data = np.arange(100) - arr = zarr.create_array(store=store, data=data) + if shards is None: + chunks = "auto" + else: + chunks = (1,) + arr = zarr.create_array(store=store, data=data, shards=shards, chunks=chunks) ctx = mp.get_context(method) with ctx.Pool() as pool: results = pool.starmap(_index_array, [(arr, slice(len(data)))]) From 595c52c58c7aafaa4ac0c135af4e682b48e36f71 Mon Sep 17 00:00:00 2001 From: Davis Bennett Date: Fri, 19 Sep 2025 08:49:41 +0200 Subject: [PATCH 2/2] Update tests/test_array.py --- tests/test_array.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_array.py b/tests/test_array.py index 47181db252..5219616739 100644 --- a/tests/test_array.py +++ b/tests/test_array.py @@ -1797,6 +1797,7 @@ def test_multiprocessing( Test that arrays can be pickled and indexed in child processes """ data = np.arange(100) + chunks: Literal["auto"] | tuple[int, ...] if shards is None: chunks = "auto" else: