Skip to content

Commit 5ece3e6

Browse files
authored
Ensure zarr.group uses writable mode (#1354)
* Fix creating a group with fsmap per issue #1353, regression test added * Update release notes
1 parent d7d8815 commit 5ece3e6

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

docs/release.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ Release notes
1515
# .. warning::
1616
# Pre-release! Use :command:`pip install --pre zarr` to evaluate this release.
1717
18+
.. _release_2.14.2:
19+
20+
2.14.2
21+
------
22+
23+
Bug fixes
24+
~~~~~~~~~
25+
26+
* Ensure ``zarr.group`` uses writeable mode to fix issue with :issue:`1304`.
27+
By :user:`Brandur Thorgrimsson <swordcat>` :issue:`1354`.
28+
1829
.. _release_2.14.1:
1930

2031
2.14.1

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)