Skip to content

Commit b65d439

Browse files
committed
Use store prefix
1 parent 8038b94 commit b65d439

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ keywords = ["Python", "compressed", "ndimensional-arrays", "zarr"]
6464
# User extras
6565
remote = [
6666
"fsspec>=2023.10.0",
67-
"obstore==0.4.0b2",
68-
67+
"obstore==0.4.0b3",
6968
]
7069
gpu = [
7170
"cupy-cuda12x",

tests/test_store/test_object.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
11
# ruff: noqa: E402
2+
import pickle
3+
from typing import Any
4+
25
import pytest
36

47
obstore = pytest.importorskip("obstore")
5-
6-
import pickle
7-
import re
8+
from obstore.store import LocalStore
89

910
from zarr.core.buffer import Buffer, cpu
1011
from zarr.storage import ObjectStore
1112
from zarr.testing.store import StoreTests
1213

13-
PATTERN = r'LocalStore\("([^"]+)"\)'
14-
1514

1615
class TestObjectStore(StoreTests[ObjectStore, cpu.Buffer]):
1716
store_cls = ObjectStore
1817
buffer_cls = cpu.Buffer
1918

2019
@pytest.fixture
21-
def store_kwargs(self, tmpdir) -> dict[str, str | bool]:
22-
store = obstore.store.LocalStore(prefix=tmpdir)
20+
def store_kwargs(self, tmpdir) -> dict[str, Any]:
21+
store = LocalStore(prefix=tmpdir)
2322
return {"store": store, "read_only": False}
2423

2524
@pytest.fixture
2625
def store(self, store_kwargs: dict[str, str | bool]) -> ObjectStore:
2726
return self.store_cls(**store_kwargs)
2827

2928
async def get(self, store: ObjectStore, key: str) -> Buffer:
30-
# TODO: Use new store.prefix in obstore 0.4.0
31-
store_path = re.search(PATTERN, str(store)).group(1)
32-
new_local_store = obstore.store.LocalStore(prefix=store_path)
29+
assert isinstance(store.store, LocalStore)
30+
new_local_store = LocalStore(prefix=store.store.prefix)
3331
return self.buffer_cls.from_bytes(obstore.get(new_local_store, key).bytes())
3432

3533
async def set(self, store: ObjectStore, key: str, value: Buffer) -> None:
36-
# TODO: Use new store.prefix in obstore 0.4.0
37-
store_path = re.search(PATTERN, str(store)).group(1)
38-
new_local_store = obstore.store.LocalStore(prefix=store_path)
34+
assert isinstance(store.store, LocalStore)
35+
new_local_store = LocalStore(prefix=store.store.prefix)
3936
obstore.put(new_local_store, key, value.to_bytes())
4037

4138
def test_store_repr(self, store: ObjectStore) -> None:

0 commit comments

Comments
 (0)