Skip to content

Conversation

shoyer
Copy link
Contributor

@shoyer shoyer commented Sep 4, 2025

Currently, read_only is not passed in open(), which means the default value of read_only=False is confusingly used instead.

This mostly just surprisng, but also has minor performance implications because read_only=False means Zarr attempts to create directories on this line (which is a no-op because exist_ok=True):

async def _open(self, *, mode: AccessModeLiteral | None = None) -> None:
if not self.read_only:
self.root.mkdir(parents=True, exist_ok=True)

TODO:

  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

Currently, `read_only` is not passed in `open()`, which means the
default value of `read_only=False` is confusingly used instead.

This mostly just surprisng, but also has minor performance implications
because `read_only=False` means Zarr attempts to create directories on
this line (which is a no-op because `exist_ok=True`):
https://github.com/zarr-developers/zarr-python/blob/e738e2fb88dbead26a853d9982ff46eab64f313f/src/zarr/storage/_local.py#L167-L169
@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Sep 4, 2025
Copy link

codecov bot commented Sep 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.92%. Comparing base (e738e2f) to head (6be197f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3432   +/-   ##
=======================================
  Coverage   94.92%   94.92%           
=======================================
  Files          79       79           
  Lines        9491     9491           
=======================================
  Hits         9009     9009           
  Misses        482      482           
Files with missing lines Coverage Δ
src/zarr/storage/_common.py 90.52% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@d-v-b
Copy link
Contributor

d-v-b commented Sep 4, 2025

is it feasible to add a test?

@shoyer
Copy link
Contributor Author

shoyer commented Sep 4, 2025

is it feasible to add a test?

I don't think so, unfortunately, short of excessive mocking. This is just an internal cleanup, to avoid code smell.

Copy link
Contributor

@d-v-b d-v-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@d-v-b d-v-b merged commit ac95b4d into zarr-developers:main Sep 4, 2025
31 checks passed
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.

2 participants