From 4244f932d5cbfdb008b032d14944789c932a1f45 Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Tue, 1 Dec 2026 09:44:44 +0100 Subject: [PATCH 1/5] chore(mypy): remove the no-op strict = false override mypy applies `strict` only when it is true, so `strict = false` in a per-module override is ignored. The 14 entries listed there (modules and globs) were already checked strictly. Remove the block, and reword the TODO on the `ignore_errors` list that pointed at it. Assisted-by: ClaudeCode:claude-opus-5-5 --- pyproject.toml | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 20685f9bc0..8bde3eea54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -373,27 +373,7 @@ strict = true warn_unreachable = true enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool", "truthy-iterable"] -[[tool.mypy.overrides]] -module = [ - "tests.package_with_entrypoint.*", - "zarr.testing.stateful", - "tests.test_codecs.test_transpose", - "tests.test_config", - "tests.test_store.test_zip", - "tests.test_store.test_local", - "tests.test_store.test_memory", - "tests.test_codecs.test_codecs", - "tests.test_metadata.*", - "tests.test_store.test_core", - "tests.test_store.test_logging", - "tests.test_store.test_object", - "tests.test_store.test_stateful", - "tests.test_store.test_wrapper", -] -strict = false - -# TODO: Move the next modules up to the strict = false section -# and fix the errors +# TODO: fix the type errors in these modules and remove them from this list [[tool.mypy.overrides]] module = [ "tests.test_store.test_fsspec", From a93132660cf311d0926b19d80717a9ab392c5547 Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Tue, 1 Dec 2026 10:25:40 +0100 Subject: [PATCH 2/5] test(fsspec): take test_fsspec off the mypy ignore list Narrow the subgroup returned by `AsyncGroup.getitem` to `AsyncGroup` before calling `group_keys`, which was the module's only mypy error, and remove `tests.test_store.test_fsspec` from the `ignore_errors` list so the module's own code is type-checked like the rest of the tests. Assisted-by: ClaudeCode:claude-opus-5-5 --- pyproject.toml | 1 - tests/test_store/test_fsspec.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8bde3eea54..1f1413bbe1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -376,7 +376,6 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool", "tr # TODO: fix the type errors in these modules and remove them from this list [[tool.mypy.overrides]] module = [ - "tests.test_store.test_fsspec", "tests.test_group", "tests.test_indexing", "tests.test_properties", diff --git a/tests/test_store/test_fsspec.py b/tests/test_store/test_fsspec.py index f26a6f316a..f7893b8408 100644 --- a/tests/test_store/test_fsspec.py +++ b/tests/test_store/test_fsspec.py @@ -13,7 +13,7 @@ from packaging.version import parse as parse_version import zarr.api.asynchronous -from zarr import Array +from zarr import Array, AsyncGroup from zarr.abc.store import OffsetByteRequest from zarr.core.buffer import Buffer, cpu, default_buffer_prototype from zarr.core.sync import _collect_aiterator, sync @@ -489,6 +489,7 @@ async def test_fsspec_store_list_nested_via_reference_filesystem(path: str) -> N group = await zarr.api.asynchronous.open_group(store, mode="r") subgroup = await group.getitem("a") + assert isinstance(subgroup, AsyncGroup) assert [name async for name in subgroup.group_keys()] == ["b"] From 711a47b6e800391b74c60c90f9b2b0f217188316 Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Tue, 1 Dec 2026 11:08:33 +0100 Subject: [PATCH 3/5] test(v2): ignore numcodecs' Pickle deprecation warning in pickle tests numcodecs main now warns that its Pickle codec is deprecated whenever one is created, and the suite turns warnings into errors, so the pickle decode-gate tests in test_v2.py fail in the upstream-dependencies job. Those tests create Pickle codecs on purpose, so ignore that warning for them. Released numcodecs doesn't warn, so the filter ignores the warning rather than requiring it. Assisted-by: ClaudeCode:claude-opus-5-5 --- tests/test_v2.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_v2.py b/tests/test_v2.py index 52068724fd..a79b9169c7 100644 --- a/tests/test_v2.py +++ b/tests/test_v2.py @@ -325,6 +325,14 @@ def test_other_dtype_roundtrip(fill_value: bytes | None, tmp_path: Path) -> None assert (a == za[:]).all() +# numcodecs deprecates its Pickle codec in newer releases and warns whenever one is created. +# These tests create Pickle codecs on purpose to check zarr's decode gate, so the warning is +# expected; older numcodecs releases don't emit it, so the filter ignores rather than asserts it. +ignore_pickle_deprecation = pytest.mark.filterwarnings( + "ignore:The Pickle codec is deprecated:DeprecationWarning" +) + + def _pickle_compressed_array() -> zarr.Array[Any]: # Writing with the pickle codec is allowed without opting in, only decoding is gated. arr = zarr.create_array( @@ -351,6 +359,7 @@ def allow_numcodecs_unpickle(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr(numcodecs.pickles, "ALLOW_UNSAFE_PICKLE_DECODE", True) +@ignore_pickle_deprecation def test_pickle_codec_read_disabled_by_default() -> None: """Reading data encoded with the pickle codec fails unless the user opts in.""" arr = _pickle_compressed_array() @@ -362,6 +371,7 @@ def test_pickle_codec_read_disabled_by_default() -> None: assert "ALLOW_UNSAFE_PICKLE_DECODE" in str(excinfo.value) +@ignore_pickle_deprecation def test_pickle_codec_read_does_not_unpickle() -> None: """A malicious chunk is not unpickled when the pickle codec is disabled.""" @@ -389,6 +399,7 @@ def __reduce__(self) -> tuple[Any, ...]: arr[:] +@ignore_pickle_deprecation def test_pickle_codec_zarr_opt_in_does_not_bypass_numcodecs( monkeypatch: pytest.MonkeyPatch, ) -> None: @@ -402,6 +413,7 @@ def test_pickle_codec_zarr_opt_in_does_not_bypass_numcodecs( arr[:] +@ignore_pickle_deprecation @pytest.mark.usefixtures("allow_numcodecs_unpickle") def test_pickle_codec_read_enabled_via_config() -> None: arr = _pickle_compressed_array() @@ -409,6 +421,7 @@ def test_pickle_codec_read_enabled_via_config() -> None: np.testing.assert_array_equal(arr[:], np.array(["a", "bb", "ccc"])) +@ignore_pickle_deprecation @pytest.mark.usefixtures("allow_numcodecs_unpickle") @pytest.mark.parametrize(("env_value", "allowed"), [("True", True), ("false", False)]) def test_pickle_codec_read_enabled_via_env_var( From ec7e3e8bd94ddb2c118c975442019f8a1cb5eb1b Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Tue, 1 Dec 2026 11:16:17 +0100 Subject: [PATCH 4/5] test(fsspec): use get_group instead of narrowing getitem's result `AsyncGroup.get_group` returns an `AsyncGroup` and raises if the member is an array, so the test needs no isinstance assert to type-check. Assisted-by: ClaudeCode:claude-opus-5-5 --- tests/test_store/test_fsspec.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_store/test_fsspec.py b/tests/test_store/test_fsspec.py index f7893b8408..faea1caf0f 100644 --- a/tests/test_store/test_fsspec.py +++ b/tests/test_store/test_fsspec.py @@ -13,7 +13,7 @@ from packaging.version import parse as parse_version import zarr.api.asynchronous -from zarr import Array, AsyncGroup +from zarr import Array from zarr.abc.store import OffsetByteRequest from zarr.core.buffer import Buffer, cpu, default_buffer_prototype from zarr.core.sync import _collect_aiterator, sync @@ -488,8 +488,7 @@ async def test_fsspec_store_list_nested_via_reference_filesystem(path: str) -> N ] group = await zarr.api.asynchronous.open_group(store, mode="r") - subgroup = await group.getitem("a") - assert isinstance(subgroup, AsyncGroup) + subgroup = await group.get_group("a") assert [name async for name in subgroup.group_keys()] == ["b"] From 45e5a3ab8fd4b4b54c871599e4080ed6075324a5 Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Tue, 1 Dec 2026 11:21:46 +0100 Subject: [PATCH 5/5] test(v2): match the Pickle deprecation comment to upstream #4680 Assisted-by: ClaudeCode:claude-opus-5-5 --- tests/test_v2.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_v2.py b/tests/test_v2.py index a79b9169c7..54ef3abb43 100644 --- a/tests/test_v2.py +++ b/tests/test_v2.py @@ -155,7 +155,7 @@ def test_create_array_defaults(store: Store) -> None: arr = g.create_array("three", dtype="i8", shape=(1,), chunks=(1,), compressor=Zstd()) assert arr.compressors != () assert not (arr.filters) - with pytest.raises(ValueError): + with pytest.raises(ValueError, match="Cannot specify both `compressor` and `compressors`"): g.create_array( "four", dtype="i8", shape=(1,), chunks=(1,), compressor=None, compressors=None ) @@ -325,9 +325,10 @@ def test_other_dtype_roundtrip(fill_value: bytes | None, tmp_path: Path) -> None assert (a == za[:]).all() -# numcodecs deprecates its Pickle codec in newer releases and warns whenever one is created. -# These tests create Pickle codecs on purpose to check zarr's decode gate, so the warning is -# expected; older numcodecs releases don't emit it, so the filter ignores rather than asserts it. +# numcodecs deprecates its Pickle codec and warns whenever one is created +# (zarr-developers/numcodecs#905). These tests create Pickle codecs on purpose to check zarr's +# decode gate, so the warning is expected. numcodecs versions without that deprecation don't +# emit it, so the filter ignores the warning rather than requiring it. ignore_pickle_deprecation = pytest.mark.filterwarnings( "ignore:The Pickle codec is deprecated:DeprecationWarning" )