|
17 | 17 | open, |
18 | 18 | open_consolidated, |
19 | 19 | ) |
20 | | -from zarr.core.buffer import Buffer, cpu, default_buffer_prototype |
| 20 | +from zarr.core.buffer import cpu, default_buffer_prototype |
21 | 21 | from zarr.core.group import ConsolidatedMetadata, GroupMetadata |
22 | 22 | from zarr.core.metadata import ArrayV3Metadata |
23 | 23 | from zarr.core.metadata.v2 import ArrayV2Metadata |
24 | 24 | from zarr.storage import StorePath |
25 | 25 |
|
26 | 26 | if TYPE_CHECKING: |
27 | | - from zarr.abc.store import ByteRequest, Store |
| 27 | + from zarr.abc.store import Store |
28 | 28 | from zarr.core.common import ZarrFormat |
29 | 29 |
|
30 | 30 |
|
@@ -661,22 +661,14 @@ def supports_consolidated_metadata(self) -> bool: |
661 | 661 | return False |
662 | 662 |
|
663 | 663 |
|
664 | | -async def test_consolidate_metadata_is_noop_for_self_consolidating_stores(): |
| 664 | +async def test_consolidate_metadata_raises_for_self_consolidating_stores(): |
665 | 665 | """Verify calling consolidate_metadata on a non supporting stores does nothing""" |
666 | 666 |
|
667 | 667 | memory_store = NonConsolidatedStore() |
668 | 668 | root = await zarr.api.asynchronous.create_group(store=memory_store) |
669 | 669 | await root.create_group("a/b") |
670 | 670 |
|
671 | | - # now we monkey patch the store so it raises if `Store.set` is called |
672 | | - async def set_raises(self, value: Buffer, byte_range: ByteRequest | None = None) -> None: |
673 | | - raise ValueError("consolidated metadata called") |
674 | | - |
675 | | - memory_store.set = set_raises |
676 | | - |
677 | | - with pytest.warns(UserWarning, match="doesn't support consolidated metadata"): |
678 | | - # consolidate_metadata would call `set` if the store supported consolidated metadata |
679 | | - # if this doesn't raise, it means consolidate_metadata is NOOP |
| 671 | + with pytest.raises(TypeError, match="doesn't support consolidated metadata"): |
680 | 672 | await zarr.api.asynchronous.consolidate_metadata(memory_store) |
681 | 673 |
|
682 | 674 |
|
|
0 commit comments