Skip to content

Commit

Permalink
Generate fixture for zarr-developers#1312 if it is missing
Browse files Browse the repository at this point in the history
This is a temporary fix for the larger issue of out-of-tree
testing described in zarr-developers#1347, but this should allow a release
of 2.14.1 which passes on conda.
  • Loading branch information
joshmoore committed Feb 12, 2023
1 parent 4e8b84b commit aab38f6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions zarr/tests/test_attrs.py
@@ -1,7 +1,9 @@
import json

import pathlib
import pytest

import zarr
from zarr._storage.store import meta_root
from zarr.attrs import Attributes
from zarr.storage import KVStore, DirectoryStore
Expand Down Expand Up @@ -50,6 +52,16 @@ def test_storage(self, zarr_version):

def test_utf8_encoding(self, zarr_version):

project_root = pathlib.Path(zarr.__file__).resolve().parent.parent
fixdir = project_root / "fixture" / "utf8attrs"
if not fixdir.exists(): # pragma: no cover
# store the data - should be one-time operation
fixdir.mkdir()
with (fixdir / ".zattrs").open("w", encoding="utf-8") as f:
f.write('{"foo": "た"}')
with (fixdir / ".zgroup").open("w", encoding="utf-8") as f:
f.write("""{\n "zarr_format": 2\n}""")

# fixture data
fixture = group(store=DirectoryStore('fixture'))
assert fixture['utf8attrs'].attrs.asdict() == dict(foo='た')
Expand Down

0 comments on commit aab38f6

Please sign in to comment.