diff --git a/src/zarr/abc/store.py b/src/zarr/abc/store.py index 7771a10464..e74e13d95a 100644 --- a/src/zarr/abc/store.py +++ b/src/zarr/abc/store.py @@ -75,10 +75,6 @@ async def _open(self) -> None: raise FileExistsError("Store already exists") self._is_open = True - async def _ensure_open(self) -> None: - if not self._is_open: - await self._open() - @abstractmethod async def empty(self) -> bool: ... diff --git a/src/zarr/storage/local.py b/src/zarr/storage/local.py index 1e1f3beec1..88b4d50cd9 100644 --- a/src/zarr/storage/local.py +++ b/src/zarr/storage/local.py @@ -93,6 +93,7 @@ def __init__(self, root: Path | str, *, mode: AccessModeLiteral = "r") -> None: root = Path(root) assert isinstance(root, Path) self.root = root + super().__init__(mode=mode) async def clear(self) -> None: self._check_writable() diff --git a/tests/v3/test_buffer.py b/tests/v3/test_buffer.py index 60816d764e..0ab5a69b80 100644 --- a/tests/v3/test_buffer.py +++ b/tests/v3/test_buffer.py @@ -48,7 +48,7 @@ async def test_async_array_prototype() -> None: expect = np.zeros((9, 9), dtype="uint16", order="F") a = await AsyncArray.create( - StorePath(StoreExpectingTestBuffer(mode="w")) / "test_async_array_prototype", + StorePath(await StoreExpectingTestBuffer.open(mode="w")) / "test_async_array_prototype", shape=expect.shape, chunk_shape=(5, 5), dtype=expect.dtype, @@ -99,7 +99,7 @@ async def test_async_array_gpu_prototype() -> None: async def test_codecs_use_of_prototype() -> None: expect = np.zeros((10, 10), dtype="uint16", order="F") a = await AsyncArray.create( - StorePath(StoreExpectingTestBuffer(mode="w")) / "test_codecs_use_of_prototype", + StorePath(await StoreExpectingTestBuffer.open(mode="w")) / "test_codecs_use_of_prototype", shape=expect.shape, chunk_shape=(5, 5), dtype=expect.dtype, diff --git a/tests/v3/test_config.py b/tests/v3/test_config.py index 62907588c7..559ec350cc 100644 --- a/tests/v3/test_config.py +++ b/tests/v3/test_config.py @@ -27,6 +27,7 @@ register_ndbuffer, register_pipeline, ) +from zarr.sync import sync from zarr.testing.buffer import ( NDBufferUsingTestNDArrayLike, StoreExpectingTestBuffer, @@ -199,8 +200,8 @@ def test_config_ndbuffer_implementation(store: Store) -> None: def test_config_buffer_implementation() -> None: # has default value assert fully_qualified_name(get_buffer_class()) == config.defaults[0]["buffer"] - - arr = zeros(shape=(100), store=StoreExpectingTestBuffer(mode="w")) + store = sync(StoreExpectingTestBuffer.open(mode="w")) + arr = zeros(shape=(100), store=store) # AssertionError of StoreExpectingTestBuffer when not using my buffer with pytest.raises(AssertionError): @@ -218,7 +219,7 @@ def test_config_buffer_implementation() -> None: data2d = np.arange(1000).reshape(100, 10) arr_sharding = zeros( shape=(100, 10), - store=StoreExpectingTestBuffer(mode="w"), + store=sync(StoreExpectingTestBuffer.open(mode="w")), codecs=[ShardingCodec(chunk_shape=(10, 10))], ) arr_sharding[:] = data2d @@ -226,7 +227,7 @@ def test_config_buffer_implementation() -> None: arr_Crc32c = zeros( shape=(100, 10), - store=StoreExpectingTestBuffer(mode="w"), + store=sync(StoreExpectingTestBuffer.open(mode="w")), codecs=[BytesCodec(), Crc32cCodec()], ) arr_Crc32c[:] = data2d diff --git a/tests/v3/test_indexing.py b/tests/v3/test_indexing.py index 38ca24a7bb..fd5c78aa12 100644 --- a/tests/v3/test_indexing.py +++ b/tests/v3/test_indexing.py @@ -224,7 +224,7 @@ def test_get_basic_selection_0d(store: StorePath, use_out: bool, value: Any, dty slice(50, 150, 10), ] -basic_selections_1d_bad = [ +basic_selections_1d_bad: list[Any] = [ # only positive step supported slice(None, None, -1), slice(None, None, -10),