Skip to content

Skip test_pyzstd when pyzstd cannot be imported - #845

Merged
d-v-b merged 2 commits into
zarr-developers:mainfrom
d-v-b:fix/pyzstd-importorskip-i386
Jun 18, 2026
Merged

d-v-b merged 2 commits into
zarr-developers:mainfrom
d-v-b:fix/pyzstd-importorskip-i386

Conversation

@d-v-b

@d-v-b d-v-b commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

On i386 (Alpine, Python 3.14), pyzstd 0.17+ delegates to the stdlib
compression.zstd module, which requires the _zstd C extension that is
not built on that platform. The hard top-level import pyzstd turned
this into a collection error, failing the entire test run.

Guard the import with pytest.importorskip so the module is skipped
instead of erroring when pyzstd is unavailable.

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

[Description of PR]

TODO:

  • Unit tests and/or doctests in docstrings
  • Tests pass locally
  • Docstrings and API docs for any new/modified user-facing classes and functions
  • Changes documented in docs/release.rst
  • Docs build locally
  • GitHub Actions CI passes
  • Test coverage to 100% (Codecov passes)

On i386 (Alpine, Python 3.14), pyzstd 0.17+ delegates to the stdlib
compression.zstd module, which requires the _zstd C extension that is
not built on that platform. The hard top-level `import pyzstd` turned
this into a collection error, failing the entire test run.

Guard the import with pytest.importorskip so the module is skipped
instead of erroring when pyzstd is unavailable.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@codecov

codecov Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (99566f0) to head (bc9b6b3).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #845   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines          901       901           
=========================================
  Hits           901       901           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@d-v-b
d-v-b merged commit 53e5157 into zarr-developers:main Jun 18, 2026
38 checks passed
d-v-b added a commit to d-v-b/numcodecs that referenced this pull request Oct 5, 2026
On Python 3.14, pyzstd imports the standard library's compression.zstd, which needs the _zstd extension module. Alpine's i386 Python does not ship it, so importing pyzstd raised ModuleNotFoundError and aborted test collection. Use pytest.importorskip, as main does (zarr-developers#845).

Assisted-by: ClaudeCode:claude-fable-5.1
d-v-b added a commit that referenced this pull request Oct 20, 2026
* test(checksum32): wrap parametrize itertools.product in tuple

pytest 9 raises PytestRemovedIn10Warning for non-Collection iterables passed to parametrize, which becomes an error under filterwarnings=error and aborts test collection. Same change as 15803df on backport-0.15-zstd-fixes.

Assisted-by: ClaudeCode:claude-fable-5.1

* ci: stop testing the 0.16.x line against zarr-python main

zarr-python main now requires Python >=3.12, while this line supports Python >=3.11. uv resolves all dependency groups together, so the test-zarr-main group made every uv invocation fail with an unsatisfiable resolution (seen in the i386 workflow). A maintenance line does not need to track zarr-python main, so remove the group, its pixi tasks, and its CI matrix entry.

Assisted-by: ClaudeCode:claude-fable-5.1

* ci: replace the macos-13 runner with macos-15-large

macos-13 runners are no longer available. macos-15-large is still an Intel runner, so x86 coverage is preserved. macOS 15's dyld rejects the duplicate LC_RPATH entries that the conda-forge compilers produce, so add the same deduplication step used on backport-0.15-zstd-fixes (64eade5, 7ae0f4b).

Assisted-by: ClaudeCode:claude-fable-5.1

* ci(docs): build on ubuntu-24.04 on Read the Docs

Read the Docs removed the ubuntu-20.04 build image.

Assisted-by: ClaudeCode:claude-fable-5.1

* ci: stop pinning clang below 17 on the Intel macOS runner

The pin downgraded the conda-forge compiler to clang 14, which cannot parse the macOS 15 SDK headers on macos-15-large (math.h: '_Float16 is not supported on this target'), so every extension build failed. Use the clang that the conda-forge c-compiler package installs instead.

Assisted-by: ClaudeCode:claude-fable-5.1

* ci(i386): install zfpy with uv pip instead of uv add

zfp's pyproject.toml has no [project] table, so 'uv add "zfpy @ ./zfp"' fails with 'No project table found'. Install the locally built zfpy into the environment with 'uv pip install ./zfp', as main does. Because zfpy is no longer recorded in pyproject.toml, keep the same virtual environment for the numcodecs install and run pytest with --no-sync so uv does not re-resolve the environment.

Assisted-by: ClaudeCode:claude-fable-5.1

* ci(i386): stop installing pcodec in the i386 job

This workflow has no matrix, so the python-version conditional always took the branch that installs pcodec. pcodec has no i386 wheel and its source build produces a wheel tagged linux_x86_64, which uv refuses to install in the i386 Alpine environment. Install without pcodec, as main does; the pcodec tests are skipped when it is missing.

Assisted-by: ClaudeCode:claude-fable-5.1

* test(pyzstd): skip test_pyzstd when pyzstd cannot be imported

On Python 3.14, pyzstd imports the standard library's compression.zstd, which needs the _zstd extension module. Alpine's i386 Python does not ship it, so importing pyzstd raised ModuleNotFoundError and aborted test collection. Use pytest.importorskip, as main does (#845).

Assisted-by: ClaudeCode:claude-fable-5.1

* ci(codecov): compare project coverage against the base commit

codecov/project has failed on every recent commit of this line, including the 0.16.5 release, at 98.68% against a 100% target. The uncovered lines are in numcodecs/zarr3.py and the crc32c fallback paths, which the coverage-uploading jobs do not exercise. Set the project target to auto so the check fails only when a change lowers coverage. The patch target stays at 100%.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant