Skip to content

Commit

Permalink
Ensure zarr.group uses writable mode (#1354)
Browse files Browse the repository at this point in the history
* Fix creating a group with fsmap per issue #1353, regression test added

* Update release notes
  • Loading branch information
Swordcat committed Feb 23, 2023
1 parent d7d8815 commit 5ece3e6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ Release notes
# .. warning::
# Pre-release! Use :command:`pip install --pre zarr` to evaluate this release.
.. _release_2.14.2:

2.14.2
------

Bug fixes
~~~~~~~~~

* Ensure ``zarr.group`` uses writeable mode to fix issue with :issue:`1304`.
By :user:`Brandur Thorgrimsson <swordcat>` :issue:`1354`.

.. _release_2.14.1:

2.14.1
Expand Down
2 changes: 1 addition & 1 deletion zarr/hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ def group(store=None, overwrite=False, chunk_store=None,
"""

# handle polymorphic store arg
store = _normalize_store_arg(store, zarr_version=zarr_version)
store = _normalize_store_arg(store, zarr_version=zarr_version, mode='w')
if zarr_version is None:
zarr_version = getattr(store, '_store_version', DEFAULT_ZARR_VERSION)

Expand Down
11 changes: 11 additions & 0 deletions zarr/tests/test_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,17 @@ def test_group(zarr_version):
assert store is g.store


@pytest.mark.skipif(have_fsspec is False, reason='needs fsspec')
@pytest.mark.parametrize('zarr_version', _VERSIONS)
def test_group_writeable_mode(zarr_version, tmp_path):
# Regression test for https://github.com/zarr-developers/zarr-python/issues/1353
import fsspec

store = fsspec.get_mapper(str(tmp_path))
zg = group(store=store)
assert zg.store.map == store


@pytest.mark.parametrize('zarr_version', _VERSIONS)
def test_open_group(zarr_version):
# test the open_group() convenience function
Expand Down

0 comments on commit 5ece3e6

Please sign in to comment.