diff --git a/tests/test_array_stateful.py b/tests/test_array_stateful.py index 3361d967e3..ca9b1d3ad8 100644 --- a/tests/test_array_stateful.py +++ b/tests/test_array_stateful.py @@ -50,6 +50,10 @@ DTYPE = np.dtype("int16") METADATA_KEYS = (".zarray", ".zattrs", "zarr.json") MAX_SIDE = 6 +# `append` may grow an axis past `MAX_SIDE`, but not without bound: with chunks of 1, +# the cells an extent of 100 steps could reach make each full-array read take seconds, +# and the nightly run of every example together exceeded pytest's faulthandler_timeout. +MAX_APPEND_EXTENT = 2 * MAX_SIDE async def _list(store: MemoryStore, prefix: str) -> list[str]: @@ -210,7 +214,8 @@ def append(self, data: st.DataObject) -> None: axes = st.sampled_from(self.legacy_axes) | axes axis = data.draw(axes, label="axis") block_shape = list(self.shape) - block_shape[axis] = data.draw(st.integers(0, 4), label="rows") + max_rows = min(4, max(0, MAX_APPEND_EXTENT - self.shape[axis])) + block_shape[axis] = data.draw(st.integers(0, max_rows), label="rows") block = data.draw(npst.arrays(DTYPE, tuple(block_shape)), label="block") note(f"append {block.shape} along {axis} to {self.shape}") if self.shape[axis] == 0 and block.shape[axis]: