Skip to content

Conversation

@ruaridhg
Copy link
Contributor

@ruaridhg ruaridhg commented Aug 11, 2025

Fixes #2961

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.rst
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Aug 11, 2025
@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Aug 11, 2025
@d-v-b
Copy link
Contributor

d-v-b commented Aug 11, 2025

thank you, this looks good. we should make sure we cover all the places in the codebase where we try to read an array. maybe it's just the 1 place you found, but we should double-check.

Copy link
Contributor

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

Two inline comments. In addition, did you thoroughly check that there's only a single place where an ArrayNotFoundError should be raised?


# path not found
with pytest.raises(FileNotFoundError):
with pytest.raises(ArrayNotFoundError):
Copy link
Contributor

Choose a reason for hiding this comment

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

This is currently failing the tests, because it actually raises a GroupNotFoundError now. I think the sensible thing to do here would be to create another new error, NodeNotFoundError, that is raised when a non-specific function is used (e.g., just open) to try and open either an array or a group.

@d-v-b
Copy link
Contributor

d-v-b commented Aug 12, 2025

it might be helpful to check out #3012, which unfortunately was too bloated to merge

@codecov
Copy link

codecov bot commented Aug 19, 2025

Codecov Report

❌ Patch coverage is 81.48148% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.62%. Comparing base (0864ee5) to head (d072012).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/zarr/errors.py 72.22% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3367      +/-   ##
==========================================
- Coverage   94.66%   94.62%   -0.05%     
==========================================
  Files          79       79              
  Lines        9444     9463      +19     
==========================================
+ Hits         8940     8954      +14     
- Misses        504      509       +5     
Files with missing lines Coverage Δ
src/zarr/api/asynchronous.py 89.96% <100.00%> (ø)
src/zarr/core/array.py 97.11% <100.00%> (+<0.01%) ⬆️
src/zarr/errors.py 86.84% <72.22%> (-13.16%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


# path not found
with pytest.raises(FileNotFoundError):
with pytest.raises((NodeNotFoundError, GroupNotFoundError)):
Copy link
Contributor

Choose a reason for hiding this comment

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

how is this raising two errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah fair point, I was getting errors in my tests with only 1 error raised but now I've changed it so GroupNotFoundError and ArrayNotFoundError inherit from NodeNotFoundError

Comment on lines +65 to +72
def __init__(self, *args: Any) -> None:
if len(args) == 1:
# Pre-formatted message
super(BaseZarrError, self).__init__(args[0])
else:
# Store and path arguments - format them
_msg = "No group found in store {!r} at path {!r}"
super(BaseZarrError, self).__init__(_msg.format(*args))
Copy link
Contributor

Choose a reason for hiding this comment

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

in a separate PR we should remove the pre-formatting of exception messages, and make every exception just take a single string

@d-v-b d-v-b enabled auto-merge (squash) August 21, 2025 08:02
@d-v-b d-v-b merged commit c019a5f into zarr-developers:main Aug 21, 2025
31 checks passed
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.

zarr.errors ArrayNotFoundError is gone in zarr 3.0

3 participants