Skip to content

Commit 44be414

Browse files
committed
Remove v3 tests
1 parent c595e44 commit 44be414

File tree

10 files changed

+75
-1920
lines changed

10 files changed

+75
-1920
lines changed

zarr/convenience.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
BaseStore,
2323
ConsolidatedMetadataStore,
2424
)
25-
from zarr._storage.v3 import ConsolidatedMetadataStoreV3
25+
from zarr._storage.store import v3_api_available
26+
27+
if v3_api_available:
28+
from zarr._storage.v3 import ConsolidatedMetadataStoreV3
29+
2630
from zarr.util import TreeViewer, buffer_size, normalize_storage_path
2731

2832
from typing import Union

zarr/hierarchy.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@
4646
rename,
4747
rmdir,
4848
)
49-
from zarr._storage.v3 import MemoryStoreV3
49+
from zarr._storage.store import v3_api_available
50+
51+
if v3_api_available:
52+
from zarr._storage.v3 import MemoryStoreV3
53+
5054
from zarr.util import (
5155
InfoReporter,
5256
TreeViewer,
@@ -609,27 +613,33 @@ def groups(self):
609613
for key in sorted(listdir(self._store, self._path)):
610614
path = self._key_prefix + key
611615
if contains_group(self._store, path, explicit_only=False):
612-
yield key, Group(
616+
yield (
617+
key,
618+
Group(
619+
self._store,
620+
path=path,
621+
read_only=self._read_only,
622+
chunk_store=self._chunk_store,
623+
cache_attrs=self.attrs.cache,
624+
synchronizer=self._synchronizer,
625+
zarr_version=self._version,
626+
),
627+
)
628+
629+
else:
630+
for key in self.group_keys():
631+
path = self._key_prefix + key
632+
yield (
633+
key,
634+
Group(
613635
self._store,
614636
path=path,
615637
read_only=self._read_only,
616638
chunk_store=self._chunk_store,
617639
cache_attrs=self.attrs.cache,
618640
synchronizer=self._synchronizer,
619641
zarr_version=self._version,
620-
)
621-
622-
else:
623-
for key in self.group_keys():
624-
path = self._key_prefix + key
625-
yield key, Group(
626-
self._store,
627-
path=path,
628-
read_only=self._read_only,
629-
chunk_store=self._chunk_store,
630-
cache_attrs=self.attrs.cache,
631-
synchronizer=self._synchronizer,
632-
zarr_version=self._version,
642+
),
633643
)
634644

635645
def array_keys(self, recurse=False):

zarr/tests/test_attrs.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@
77
from zarr._storage.store import meta_root
88
from zarr.attrs import Attributes
99
from zarr.storage import KVStore, DirectoryStore
10-
from zarr._storage.v3 import KVStoreV3
11-
from zarr.tests.util import CountingDict, CountingDictV3
10+
11+
12+
from zarr.tests.util import CountingDict
1213
from zarr.hierarchy import group
1314

15+
pytestmark = pytest.mark.filterwarnings("ignore:zarr.*v3 is deprecated:DeprecationWarning")
1416

15-
@pytest.fixture(params=[2, 3])
17+
18+
@pytest.fixture(params=[2])
1619
def zarr_version(request):
1720
return request.param
1821

1922

2023
def _init_store(version):
2124
"""Use a plain dict() for v2, but KVStoreV3 otherwise."""
22-
if version == 2:
23-
return dict()
24-
return KVStoreV3(dict())
25+
return dict
2526

2627

2728
class TestAttributes:
@@ -154,8 +155,8 @@ def test_caching_on(self, zarr_version):
154155
# caching is turned on by default
155156

156157
# setup store
157-
store = CountingDict() if zarr_version == 2 else CountingDictV3()
158-
attrs_key = ".zattrs" if zarr_version == 2 else "meta/root/attrs"
158+
store = CountingDict()
159+
attrs_key = ".zattrs"
159160
assert 0 == store.counter["__getitem__", attrs_key]
160161
assert 0 == store.counter["__setitem__", attrs_key]
161162
if zarr_version == 2:
@@ -228,7 +229,7 @@ def test_caching_on(self, zarr_version):
228229

229230
def test_caching_off(self, zarr_version):
230231
# setup store
231-
store = CountingDict() if zarr_version == 2 else CountingDictV3()
232+
store = CountingDict()
232233
attrs_key = ".zattrs" if zarr_version == 2 else "meta/root/attrs"
233234
assert 0 == store.counter["__getitem__", attrs_key]
234235
assert 0 == store.counter["__setitem__", attrs_key]

0 commit comments

Comments
 (0)