Skip to content

Commit 51d5f11

Browse files
committed
Fix creating a group with fsmap per issue #1353, regression test added
1 parent d7d8815 commit 51d5f11

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

zarr/hierarchy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ def group(store=None, overwrite=False, chunk_store=None,
13361336
"""
13371337

13381338
# handle polymorphic store arg
1339-
store = _normalize_store_arg(store, zarr_version=zarr_version)
1339+
store = _normalize_store_arg(store, zarr_version=zarr_version, mode='w')
13401340
if zarr_version is None:
13411341
zarr_version = getattr(store, '_store_version', DEFAULT_ZARR_VERSION)
13421342

zarr/tests/test_hierarchy.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,17 @@ def test_group(zarr_version):
15911591
assert store is g.store
15921592

15931593

1594+
@pytest.mark.skipif(have_fsspec is False, reason='needs fsspec')
1595+
@pytest.mark.parametrize('zarr_version', _VERSIONS)
1596+
def test_group_writeable_mode(zarr_version, tmp_path):
1597+
# Regression test for https://github.com/zarr-developers/zarr-python/issues/1353
1598+
import fsspec
1599+
1600+
store = fsspec.get_mapper(str(tmp_path))
1601+
zg = group(store=store)
1602+
assert zg.store.map == store
1603+
1604+
15941605
@pytest.mark.parametrize('zarr_version', _VERSIONS)
15951606
def test_open_group(zarr_version):
15961607
# test the open_group() convenience function

0 commit comments

Comments
 (0)