Skip to content

test: pytest cleanups / modernization - #4093

Merged
d-v-b merged 12 commits into
zarr-developers:mainfrom
d-v-b:test-pytest-modernization
Jun 22, 2026
Merged

test: pytest cleanups / modernization#4093
d-v-b merged 12 commits into
zarr-developers:mainfrom
d-v-b:test-pytest-modernization

Conversation

@d-v-b

@d-v-bd-v-b commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

I had claude do a review of our test suite. The tracking issue is on my fork of zarr-python.

Pure test-suite cleanup (no library/behavior changes) adopting current pytest idioms. Part of the test-suite audit.

Changes

  • Migrate tmpdir/LEGACY_PATHtmp_path. Replace the legacy py.path.localtmpdir fixture and the private from _pytest.compat import LEGACY_PATH import with the stdlib tmp_path: pathlib.Path fixture across tests/conftest.py, tests/test_group.py, tests/test_store/test_core.py, tests/test_store/test_local.py, and tests/test_api.py. Also fixes an inverted annotation (tmp_path: LEGACY_PATH). The only remaining tmpdir references are inside commented-out dead code in tests/test_api.py.
  • Remove redundant @pytest.mark.asyncio decorators. With asyncio_mode = "auto", async def test_* are collected automatically, so the ~10 explicit markers in test_buffer.py, test_properties.py, and test_api.py are unnecessary. Also drop the now-unused asyncio and s3 entries from the markers list in pyproject.toml (the s3 marker was never applied anywhere).
  • Stabilize parametrize ids.test_docstring_consistent_parameters previously used ids=str, which stringified function objects to non-deterministic <function ... at 0x...> ids. Cases are now wrapped in pytest.param(..., id=...) with stable, human-readable ids.
  • Use monkeypatch.setenv. The docs_s3_backend fixture in tests/test_docs.py now sets AWS_ENDPOINT_URL via monkeypatch.setenv (auto-restored) instead of a manual os.environ save/restore.

Verification

  • pytest tests/test_store/ tests/test_group.py tests/test_buffer.py tests/test_api/test_synchronous.py tests/test_api.py -q1737 passed, 214 skipped.
  • pytest --co -q collects cleanly (6479 tests, no errors). ruff, mypy, numpydoc pre-commit pass.

Part of #195

dependabotBotand others added 10 commits May 31, 2026 19:28
…#176)
Bumps the actions group with 8 updates in the / directory:
| Package | From | To |
| --- | --- | --- |
| [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi) | `0.9.5` | `0.9.6` |
| [codecov/codecov-action](https://github.com/codecov/codecov-action) | `6.0.0` | `6.0.1` |
| [github/issue-metrics](https://github.com/github/issue-metrics) | `4.2.2` | `4.2.7` |
| [j178/prek-action](https://github.com/j178/prek-action) | `2.0.3` | `2.0.4` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `7.0.0` | `7.0.1` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `7.0.0` | `8.0.1` |
| [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) | `1.13.0` | `1.14.0` |
| [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) | `0.5.3` | `0.5.6` |
Updates `prefix-dev/setup-pixi` from 0.9.5 to 0.9.6
- [Release notes](https://github.com/prefix-dev/setup-pixi/releases)
- [Commits](prefix-dev/setup-pixi@1b2de7f...5185adf)
Updates `codecov/codecov-action` from 6.0.0 to 6.0.1
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@57e3a13...e79a696)
Updates `github/issue-metrics` from 4.2.2 to 4.2.7
- [Release notes](https://github.com/github/issue-metrics/releases)
- [Commits](github-community-projects/issue-metrics@c9e9838...1e38d5e)
Updates `j178/prek-action` from 2.0.3 to 2.0.4
- [Release notes](https://github.com/j178/prek-action/releases)
- [Commits](j178/prek-action@6ad8027...bdca6f1)
Updates `actions/upload-artifact` from 7.0.0 to 7.0.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v7...043fb46)
Updates `actions/download-artifact` from 7.0.0 to 8.0.1
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v7...3e5f45b)
Updates `pypa/gh-action-pypi-publish` from 1.13.0 to 1.14.0
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](pypa/gh-action-pypi-publish@v1.13.0...cef2210)
Updates `zizmorcore/zizmor-action` from 0.5.3 to 0.5.6
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](zizmorcore/zizmor-action@b1d7e1f...5f14fd0)
---
updated-dependencies:
- dependency-name: prefix-dev/setup-pixi
dependency-version: 0.9.6
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: actions
- dependency-name: codecov/codecov-action
dependency-version: 6.0.1
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: actions
- dependency-name: github/issue-metrics
dependency-version: 4.2.7
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: actions
- dependency-name: j178/prek-action
dependency-version: 2.0.4
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: actions
- dependency-name: actions/upload-artifact
dependency-version: 7.0.1
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: actions
- dependency-name: actions/download-artifact
dependency-version: 8.0.1
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: actions
- dependency-name: pypa/gh-action-pypi-publish
dependency-version: 1.14.0
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: actions
- dependency-name: zizmorcore/zizmor-action
dependency-version: 0.5.6
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: actions
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…keypatch)
- Migrate legacy `tmpdir`/`_pytest.compat.LEGACY_PATH` fixtures to the
stdlib `tmp_path: pathlib.Path` fixture across conftest and tests; remove
the private `_pytest.compat` import and fix an inverted annotation.
- Remove redundant `@pytest.mark.asyncio` decorators (asyncio_mode="auto"
collects async tests automatically) and drop the now-unused `asyncio`
and `s3` entries from the pyproject markers list.
- Give `test_docstring_consistent_parameters` stable, human-readable
parametrize ids via `pytest.param(..., id=...)`.
- Use `monkeypatch.setenv` (auto-restored) instead of manual env
save/restore in `tests/test_docs.py`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actionsgithub-actionsBot added the needs release notes Automatically applied to PRs which haven't added release notes label Jun 22, 2026
d-v-band others added 2 commits June 22, 2026 13:32
The previous commit removed the `s3` marker from pyproject, but it is
still applied dynamically to doc-example tests (e.g. the `markers="s3"`
block in docs/quick-start.md, via getattr(pytest.mark, name) in
tests/test_docs.py). Under `--strict-markers` the unknown mark is
escalated to a collection error, breaking the doctests, py=3.12, and
"Test complete" CI jobs. The `asyncio` marker removal is kept since
pytest-asyncio's auto mode registers that marker itself.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@d-v-b

Copy link
Copy Markdown
ContributorAuthor

I'm going to merge this. These changes are confined to our tests and fully revertible.

@d-v-b
d-v-b merged commit a63ebd5 into zarr-developers:mainJun 22, 2026
30 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@d-v-b