Skip to content

test(v2): ignore numcodecs' Pickle deprecation warning in pickle tests - #4680

Merged
d-v-b merged 1 commit into
zarr-developers:mainfrom
d-v-b:test/ignore-numcodecs-pickle-deprecation
Dec 1, 2026
Merged

d-v-b merged 1 commit into
zarr-developers:mainfrom
d-v-b:test/ignore-numcodecs-pickle-deprecation

Conversation

@d-v-b

@d-v-b d-v-b commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

the pickle codec is now deprecated in numcodecs, so we handle the deprecation in our tests against numcodecs main.

🤖 AI text below 🤖

Fixes the py=3.15-upstream test job, which has failed since zarr-developers/numcodecs#905 made numcodecs warn whenever a Pickle codec is created. The pickle decode-gate tests in tests/test_v2.py create Pickle codecs on purpose, so they now ignore that one deprecation warning.

Details
  • Failure: in chore(mypy): remove the no-op strict = false override d-v-b/zarr-python#486's run of this job, 6 tests failed and 14,291 passed. All 6 were the test_pickle_codec_* tests (four tests, plus both cases of the env-var test). The suite turns warnings into errors.
  • Fix: a named filterwarnings mark, ignore:The Pickle codec is deprecated:DeprecationWarning, applied only to the tests that create a Pickle codec. test_pickle_opt_in_does_not_affect_other_codecs creates none and stays unmarked. The filter ignores the warning rather than requiring it, because released numcodecs (0.17.1 and earlier) doesn't emit it, and the jobs pinned to released numcodecs should keep passing.
  • Why filter on the message, not the module: numcodecs sets skip_file_prefixes, so the warning is attributed to the caller (zarr/registry.py or the test file), not to numcodecs.
  • Verification: installing numcodecs from git wasn't possible locally. Instead, a pytest plugin patched released numcodecs' Pickle.__init__ to emit Bump pymongo from 3.12.1 to 4.0.1 #905's warning with the same message and skip_file_prefixes.
    • With the plugin, the 6 tests fail without this change, and tests/test_v2.py passes with it (35 passed).
    • With the plugin, the full suite gives 14,499 passed, 0 failed, so nothing else constructs a Pickle.
    • zarr's src/ never constructs one. Docs, examples and zarr.testing strategies don't either.
Adversarial review record

One round by a fresh reviewer agent, given only the diff and the files. It found nothing serious.

  • Minor: the comment said numcodecs deprecates Pickle "in newer releases", but no release has it yet. Fixed: the comment now cites numcodecs#905 and makes no claim about releases.
  • Minor, suggested follow-up, not done here: when numcodecs removes Pickle in 0.19.0, the module-level from numcodecs import ... Pickle will stop the whole of test_v2.py from collecting. Moving the pickle tests into their own module would contain that, and would let one pytestmark replace the per-test marks.
  • Nit: other structures were considered and rejected. A version-conditional pytest.warns would have to read private numcodecs state, and a global ini filter would be broader than needed.
  • Outside this diff, noted for separate issues:
    • Users reading pickle-compressed v2 arrays won't see the deprecation, because Python's default filters hide DeprecationWarning that isn't raised from __main__.
    • The upstream hatch env pins Python 3.14, so the job named py=3.15-upstream runs 3.14.

🤖 Generated with Claude Code

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
@github-actions github-actions Bot added the needs release notes Automatically applied to PRs which haven't added release notes label Dec 1, 2026
d-v-b added a commit to d-v-b/zarr-python that referenced this pull request Dec 1, 2026
@d-v-b
d-v-b marked this pull request as ready for review December 1, 2026 10:23
@d-v-b
d-v-b merged commit f2b894d into zarr-developers:main Dec 1, 2026
37 checks passed
d-v-b added a commit that referenced this pull request Dec 4, 2026
* 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

* 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

* 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

* 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

* test(v2): match the Pickle deprecation comment to upstream #4680

Assisted-by: ClaudeCode:claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs release notes Automatically applied to PRs which haven't added release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant