Skip to content

Commit 9f45997

Browse files
committed
simplify group tests by removing zip and remote store cases
1 parent 0c03d4a commit 9f45997

File tree

1 file changed

+41
-45
lines changed

1 file changed

+41
-45
lines changed

tests/test_group.py

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def exists_ok(request: pytest.FixtureRequest) -> bool:
3636
return result
3737

3838

39-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
39+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
4040
def test_group_init(store: Store, zarr_format: ZarrFormat) -> None:
4141
"""
4242
Test that initializing a group from an asyncgroup works.
@@ -46,7 +46,7 @@ def test_group_init(store: Store, zarr_format: ZarrFormat) -> None:
4646
assert group._async_group == agroup
4747

4848

49-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
49+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
5050
async def test_create_creates_parents(store: Store, zarr_format: ZarrFormat) -> None:
5151
# prepare a root node, with some data set
5252
await zarr.api.asynchronous.open_group(
@@ -99,7 +99,7 @@ async def test_create_creates_parents(store: Store, zarr_format: ZarrFormat) ->
9999
assert g.attrs == {}
100100

101101

102-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
102+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
103103
def test_group_name_properties(store: Store, zarr_format: ZarrFormat) -> None:
104104
"""
105105
Test basic properties of groups
@@ -120,7 +120,7 @@ def test_group_name_properties(store: Store, zarr_format: ZarrFormat) -> None:
120120
assert bar.basename == "bar"
121121

122122

123-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
123+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
124124
@pytest.mark.parametrize("consolidated_metadata", [True, False])
125125
def test_group_members(store: Store, zarr_format: ZarrFormat, consolidated_metadata: bool) -> None:
126126
"""
@@ -203,7 +203,7 @@ def test_group_members(store: Store, zarr_format: ZarrFormat, consolidated_metad
203203
members_observed = group.members(max_depth=-1)
204204

205205

206-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
206+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
207207
def test_group(store: Store, zarr_format: ZarrFormat) -> None:
208208
"""
209209
Test basic Group routines.
@@ -246,7 +246,7 @@ def test_group(store: Store, zarr_format: ZarrFormat) -> None:
246246
assert dict(bar3.attrs) == {"baz": "qux", "name": "bar"}
247247

248248

249-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
249+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
250250
def test_group_create(store: Store, exists_ok: bool, zarr_format: ZarrFormat) -> None:
251251
"""
252252
Test that `Group.from_store` works as expected.
@@ -263,7 +263,7 @@ def test_group_create(store: Store, exists_ok: bool, zarr_format: ZarrFormat) ->
263263
_ = Group.from_store(store, exists_ok=exists_ok, zarr_format=zarr_format)
264264

265265

266-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
266+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
267267
def test_group_open(store: Store, zarr_format: ZarrFormat, exists_ok: bool) -> None:
268268
"""
269269
Test the `Group.open` method.
@@ -301,7 +301,7 @@ def test_group_open(store: Store, zarr_format: ZarrFormat, exists_ok: bool) -> N
301301

302302

303303
@pytest.mark.parametrize("consolidated", [True, False])
304-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
304+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
305305
def test_group_getitem(store: Store, zarr_format: ZarrFormat, consolidated: bool) -> None:
306306
"""
307307
Test the `Group.__getitem__` method.
@@ -358,7 +358,7 @@ def test_group_getitem(store: Store, zarr_format: ZarrFormat, consolidated: bool
358358
group["subarray/subsubarray"]
359359

360360

361-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
361+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
362362
def test_group_get_with_default(store: Store, zarr_format: ZarrFormat) -> None:
363363
group = Group.from_store(store, zarr_format=zarr_format)
364364

@@ -379,7 +379,7 @@ def test_group_get_with_default(store: Store, zarr_format: ZarrFormat) -> None:
379379

380380

381381
@pytest.mark.parametrize("consolidated", [True, False])
382-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
382+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
383383
def test_group_delitem(store: Store, zarr_format: ZarrFormat, consolidated: bool) -> None:
384384
"""
385385
Test the `Group.__delitem__` method.
@@ -409,7 +409,7 @@ def test_group_delitem(store: Store, zarr_format: ZarrFormat, consolidated: bool
409409
group["subarray"]
410410

411411

412-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
412+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
413413
def test_group_iter(store: Store, zarr_format: ZarrFormat) -> None:
414414
"""
415415
Test the `Group.__iter__` method.
@@ -419,7 +419,7 @@ def test_group_iter(store: Store, zarr_format: ZarrFormat) -> None:
419419
assert list(group) == []
420420

421421

422-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
422+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
423423
def test_group_len(store: Store, zarr_format: ZarrFormat) -> None:
424424
"""
425425
Test the `Group.__len__` method.
@@ -429,7 +429,7 @@ def test_group_len(store: Store, zarr_format: ZarrFormat) -> None:
429429
assert len(group) == 0
430430

431431

432-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
432+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
433433
def test_group_setitem(store: Store, zarr_format: ZarrFormat) -> None:
434434
"""
435435
Test the `Group.__setitem__` method.
@@ -456,7 +456,7 @@ def test_group_setitem(store: Store, zarr_format: ZarrFormat) -> None:
456456
np.testing.assert_array_equal(group[key], arr)
457457

458458

459-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
459+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
460460
def test_group_contains(store: Store, zarr_format: ZarrFormat) -> None:
461461
"""
462462
Test the `Group.__contains__` method
@@ -467,7 +467,7 @@ def test_group_contains(store: Store, zarr_format: ZarrFormat) -> None:
467467
assert "foo" in group
468468

469469

470-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
470+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
471471
@pytest.mark.parametrize("consolidate", [True, False])
472472
def test_group_child_iterators(store: Store, zarr_format: ZarrFormat, consolidate: bool):
473473
group = Group.from_store(store, zarr_format=zarr_format)
@@ -573,7 +573,7 @@ def test_group_child_iterators(store: Store, zarr_format: ZarrFormat, consolidat
573573
assert sorted(group.array_values(), key=lambda x: x.name) == expected_array_values
574574

575575

576-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
576+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
577577
def test_group_update_attributes(store: Store, zarr_format: ZarrFormat) -> None:
578578
"""
579579
Test the behavior of `Group.update_attributes`
@@ -587,7 +587,7 @@ def test_group_update_attributes(store: Store, zarr_format: ZarrFormat) -> None:
587587

588588

589589
@pytest.mark.parametrize("method", ["create_array", "array"])
590-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
590+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
591591
def test_group_create_array(
592592
store: Store,
593593
zarr_format: ZarrFormat,
@@ -622,7 +622,7 @@ def test_group_create_array(
622622
assert np.array_equal(array[:], data)
623623

624624

625-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
625+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
626626
def test_group_array_creation(
627627
store: Store,
628628
zarr_format: ZarrFormat,
@@ -691,9 +691,7 @@ def test_group_array_creation(
691691
assert full_like_array.store_path.store == store
692692

693693

694-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
695-
@pytest.mark.parametrize("zarr_format", [2, 3])
696-
@pytest.mark.parametrize("exists_ok", [True, False])
694+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
697695
@pytest.mark.parametrize("extant_node", ["array", "group"])
698696
def test_group_creation_existing_node(
699697
store: Store,
@@ -740,7 +738,7 @@ def test_group_creation_existing_node(
740738
)
741739

742740

743-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
741+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
744742
async def test_asyncgroup_create(
745743
store: Store,
746744
exists_ok: bool,
@@ -783,15 +781,15 @@ async def test_asyncgroup_create(
783781
)
784782

785783

786-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
784+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
787785
async def test_asyncgroup_attrs(store: Store, zarr_format: ZarrFormat) -> None:
788786
attributes = {"foo": 100}
789787
agroup = await AsyncGroup.from_store(store, zarr_format=zarr_format, attributes=attributes)
790788

791789
assert agroup.attrs == agroup.metadata.attributes == attributes
792790

793791

794-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
792+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
795793
async def test_asyncgroup_info(store: Store, zarr_format: ZarrFormat) -> None:
796794
agroup = await AsyncGroup.from_store( # noqa: F841
797795
store,
@@ -801,7 +799,7 @@ async def test_asyncgroup_info(store: Store, zarr_format: ZarrFormat) -> None:
801799
# assert agroup.info == agroup.metadata.info
802800

803801

804-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
802+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
805803
async def test_asyncgroup_open(
806804
store: Store,
807805
zarr_format: ZarrFormat,
@@ -823,7 +821,7 @@ async def test_asyncgroup_open(
823821
assert group_w == group_r
824822

825823

826-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
824+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
827825
async def test_asyncgroup_open_wrong_format(
828826
store: Store,
829827
zarr_format: ZarrFormat,
@@ -844,7 +842,7 @@ async def test_asyncgroup_open_wrong_format(
844842

845843
# todo: replace the dict[str, Any] type with something a bit more specific
846844
# should this be async?
847-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
845+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
848846
@pytest.mark.parametrize(
849847
"data",
850848
[
@@ -867,7 +865,7 @@ def test_asyncgroup_from_dict(store: Store, data: dict[str, Any]) -> None:
867865
# todo: replace this with a declarative API where we model a full hierarchy
868866

869867

870-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
868+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
871869
async def test_asyncgroup_getitem(store: Store, zarr_format: ZarrFormat) -> None:
872870
"""
873871
Create an `AsyncGroup`, then create members of that group, and ensure that we can access those
@@ -890,7 +888,7 @@ async def test_asyncgroup_getitem(store: Store, zarr_format: ZarrFormat) -> None
890888
await agroup.getitem("foo")
891889

892890

893-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
891+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
894892
async def test_asyncgroup_delitem(store: Store, zarr_format: ZarrFormat) -> None:
895893
if not store.supports_deletes:
896894
pytest.skip("store does not support deletes")
@@ -927,7 +925,7 @@ async def test_asyncgroup_delitem(store: Store, zarr_format: ZarrFormat) -> None
927925
raise AssertionError
928926

929927

930-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
928+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
931929
async def test_asyncgroup_create_group(
932930
store: Store,
933931
zarr_format: ZarrFormat,
@@ -944,7 +942,7 @@ async def test_asyncgroup_create_group(
944942
assert subnode.metadata.zarr_format == zarr_format
945943

946944

947-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
945+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
948946
async def test_asyncgroup_create_array(
949947
store: Store, zarr_format: ZarrFormat, exists_ok: bool
950948
) -> None:
@@ -984,7 +982,7 @@ async def test_asyncgroup_create_array(
984982
assert subnode.metadata.zarr_format == zarr_format
985983

986984

987-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
985+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
988986
async def test_asyncgroup_update_attributes(store: Store, zarr_format: ZarrFormat) -> None:
989987
"""
990988
Test that the AsyncGroup.update_attributes method works correctly.
@@ -999,8 +997,7 @@ async def test_asyncgroup_update_attributes(store: Store, zarr_format: ZarrForma
999997
assert agroup_new_attributes.attrs == attributes_new
1000998

1001999

1002-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1003-
@pytest.mark.parametrize("zarr_format", [2, 3])
1000+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
10041001
async def test_serializable_async_group(store: LocalStore, zarr_format: ZarrFormat) -> None:
10051002
expected = await AsyncGroup.from_store(
10061003
store=store, attributes={"foo": 999}, zarr_format=zarr_format
@@ -1010,8 +1007,7 @@ async def test_serializable_async_group(store: LocalStore, zarr_format: ZarrForm
10101007
assert actual == expected
10111008

10121009

1013-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1014-
@pytest.mark.parametrize("zarr_format", [2, 3])
1010+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
10151011
def test_serializable_sync_group(store: LocalStore, zarr_format: ZarrFormat) -> None:
10161012
expected = Group.from_store(store=store, attributes={"foo": 999}, zarr_format=zarr_format)
10171013
p = pickle.dumps(expected)
@@ -1020,7 +1016,7 @@ def test_serializable_sync_group(store: LocalStore, zarr_format: ZarrFormat) ->
10201016

10211017

10221018
@pytest.mark.parametrize("consolidated_metadata", [True, False])
1023-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1019+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
10241020
async def test_group_members_async(store: Store, consolidated_metadata: bool) -> None:
10251021
group = await AsyncGroup.from_store(
10261022
store=store,
@@ -1096,7 +1092,7 @@ async def test_group_members_async(store: Store, consolidated_metadata: bool) ->
10961092
assert nmembers == 4
10971093

10981094

1099-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1095+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
11001096
async def test_require_group(store: Store, zarr_format: ZarrFormat) -> None:
11011097
root = await AsyncGroup.from_store(store=store, zarr_format=zarr_format)
11021098

@@ -1127,7 +1123,7 @@ async def test_require_group(store: Store, zarr_format: ZarrFormat) -> None:
11271123
await foo_group.require_group("bar")
11281124

11291125

1130-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1126+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
11311127
async def test_require_groups(store: Store, zarr_format: ZarrFormat) -> None:
11321128
root = await AsyncGroup.from_store(store=store, zarr_format=zarr_format)
11331129
# create foo group
@@ -1149,7 +1145,7 @@ async def test_require_groups(store: Store, zarr_format: ZarrFormat) -> None:
11491145
assert no_group == ()
11501146

11511147

1152-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1148+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
11531149
async def test_create_dataset(store: Store, zarr_format: ZarrFormat) -> None:
11541150
root = await AsyncGroup.from_store(store=store, zarr_format=zarr_format)
11551151
with pytest.warns(DeprecationWarning):
@@ -1164,7 +1160,7 @@ async def test_create_dataset(store: Store, zarr_format: ZarrFormat) -> None:
11641160
await root.create_dataset("bar", shape=(100,), dtype="int8")
11651161

11661162

1167-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1163+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
11681164
async def test_require_array(store: Store, zarr_format: ZarrFormat) -> None:
11691165
root = await AsyncGroup.from_store(store=store, zarr_format=zarr_format)
11701166
foo1 = await root.require_array("foo", shape=(10,), dtype="i8", attributes={"foo": 101})
@@ -1246,7 +1242,7 @@ def test_open_mutable_mapping_sync():
12461242

12471243

12481244
class TestConsolidated:
1249-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1245+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
12501246
async def test_group_getitem_consolidated(self, store: Store) -> None:
12511247
root = await AsyncGroup.from_store(store=store)
12521248
# Set up the test structure with
@@ -1297,7 +1293,7 @@ async def test_group_getitem_consolidated(self, store: Store) -> None:
12971293
rg2 = await rg1.getitem("g2")
12981294
assert rg2.metadata.consolidated_metadata == ConsolidatedMetadata(metadata={})
12991295

1300-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1296+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
13011297
async def test_group_delitem_consolidated(self, store: Store) -> None:
13021298
if isinstance(store, ZipStore):
13031299
raise pytest.skip("Not implemented")
@@ -1334,7 +1330,7 @@ async def test_group_delitem_consolidated(self, store: Store) -> None:
13341330
assert len(group.metadata.consolidated_metadata.metadata) == 1
13351331
assert "g0" not in group.metadata.consolidated_metadata.metadata
13361332

1337-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1333+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
13381334
def test_open_consolidated_raises(self, store: Store) -> None:
13391335
if isinstance(store, ZipStore):
13401336
raise pytest.skip("Not implemented")
@@ -1355,7 +1351,7 @@ def test_open_consolidated_raises(self, store: Store) -> None:
13551351
group = zarr.open_group(store=store, use_consolidated=False)
13561352
assert group.metadata.consolidated_metadata is None
13571353

1358-
@pytest.mark.parametrize("store", ["local", "memory", "remote", "zip"], indirect=True)
1354+
@pytest.mark.parametrize("store", ["local", "memory"], indirect=True)
13591355
async def test_open_consolidated_raises_async(self, store: Store) -> None:
13601356
if isinstance(store, ZipStore):
13611357
raise pytest.skip("Not implemented")

0 commit comments

Comments
 (0)