Skip to content

Commit 76fce14

Browse files
authored
Generate fixture for #1312 if it is missing (#1348)
This is a temporary fix for the larger issue of out-of-tree testing described in #1347, but this should allow a release of 2.14.1 which passes on conda.
1 parent 4e8b84b commit 76fce14

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

zarr/tests/test_attrs.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import json
22

3+
import pathlib
34
import pytest
45

6+
import zarr
57
from zarr._storage.store import meta_root
68
from zarr.attrs import Attributes
79
from zarr.storage import KVStore, DirectoryStore
@@ -50,6 +52,16 @@ def test_storage(self, zarr_version):
5052

5153
def test_utf8_encoding(self, zarr_version):
5254

55+
project_root = pathlib.Path(zarr.__file__).resolve().parent.parent
56+
fixdir = project_root / "fixture" / "utf8attrs"
57+
if not fixdir.exists(): # pragma: no cover
58+
# store the data - should be one-time operation
59+
fixdir.mkdir()
60+
with (fixdir / ".zattrs").open("w", encoding="utf-8") as f:
61+
f.write('{"foo": "た"}')
62+
with (fixdir / ".zgroup").open("w", encoding="utf-8") as f:
63+
f.write("""{\n "zarr_format": 2\n}""")
64+
5365
# fixture data
5466
fixture = group(store=DirectoryStore('fixture'))
5567
assert fixture['utf8attrs'].attrs.asdict() == dict(foo='た')

0 commit comments

Comments
 (0)