Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/zarr/testing/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,9 @@ async def test_set_if_not_exists(self, store: S) -> None:
data_buf = self.buffer_cls.from_bytes(b"0000")
await self.set(store, key, data_buf)

new = self.buffer_cls.from_bytes(b"1111")
await store.set_if_not_exists("k", new) # no error
with pytest.raises(Exception):
Copy link
Contributor

Choose a reason for hiding this comment

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

can we be more specific about the exception? Ideally we would match the type and the error message

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not quite sure how to manage matching the type with optional dependencies. Obstore raises its AlreadyExistsError and fsspec raises its FileExistsError. One option is to put this as NotImplemented in the base test class and require the individual stores to implement it in their tests, but that seems non-ideal. Do you have advice?

Matching the error message would be easier because we wouldn't need to import those errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

if it's not simple to get more specific than Exception than I think it's OK to leave it as-is, and i can open an issue about how we could make this particular test more specific 😄

new = self.buffer_cls.from_bytes(b"1111")
await store.set_if_not_exists("k", new)

result = await store.get(key, default_buffer_prototype())
assert result == data_buf
Expand Down
Loading