-
-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StoreTest
has some odd parameterizations
#2698
Comments
currently the Out of curiosity, what was the custom store you were trying to adapt? Because the 2.x store base classes were designed in the same way as 3.0 -- they just mapped strings to bytes, without applying any zarr semantics. |
We are using an in-house store implementation that loosely targets some goals of Icechunk (predates Icechunk). I only came across the The implementation is sensitive to whether the key is a chunk or metadata key because the metadata updates are handled specially to ensure read consistency. If you'd like to keep StoreTest agnostic to Zarr format, we can simply override the problematic test cases. |
Right, in this case our store classes are at a lower abstraction level than this, so we should expect their tests to fail for something higher level. For what it's worth, we have considered making the stores less general and more zarr-format-specific, in part because chunks files and metadata might benefit from different treatment (e.g., separate caches). But I don't think there are active proposals for this right now. |
I think overriding those cases is the right course of action here -- since modelling the zarr format is not part of the store design, even if we changed the relevant test cases to use "real" zarr keys and "real" zarr metadata documents, it's possible that we might revert those changes that one day. It's probably safer if you explicitly ensure on your end that the store tests model your store class properly. |
Sounds good. Closing. |
I would like to see us update these tests to use valid zarr metadata when writing to these stores. Alternatively, we could move the offending tests to specific stores (e.g. ZipStore). |
doesn't the rest of the zarr test suite essentially test the ability of the store to read and write valid zarr metadata documents? |
We have a lot of tests like this: zarr-python/src/zarr/testing/store.py Line 230 in b982224
I think it's important that tests are short and readable. Using |
What I have essentially done on my side is create a constant that is """{
"attributes": {},
"zarr_format": 3,
"consolidated_metadata": null,
"node_type": "group"
}""".encode() and used that as payloads for |
we will need multiple pieces of data, to ensure that our store routines don't inadvertantly associate multiple keys with the same payload. These could be generated with a function that takes a dict |
Zarr version
3.0.0
Numcodecs version
0.14.1
Python Version
3.13
Operating System
Linux
Installation
Using
pip
Description
These parameterizations for
test_set
and these combinations intest_set_many
end up testing for patterns that won't occur: Azarr.json
whose contents are arbitrary bytes or empty or contain the string "zarr.json".I was adapting a custom store from v2 land and hit a few test case failures due to this (during JSON deserialization of the
zarr.json
file). Any interest in making the pytest parameterizations a bit more realistic? I can take a stab at it if so.Steps to reproduce
Write a custom store implementation that actually performs JSON deserialization of
zarr.json
.Additional output
No response
The text was updated successfully, but these errors were encountered: