Skip to content

Commit

Permalink
test_dim_separator.py Generate fixtures when needed (#824)
Browse files Browse the repository at this point in the history
* test_dim_separator.py Generate fixtures when needed

see: conda-forge/zarr-feedstock#50

* Correct flake8 issues

* Add 'pragma: no cover' to the one-off
  • Loading branch information
joshmoore authored Aug 26, 2021
1 parent 0ae77c7 commit 3a64977
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions zarr/tests/test_dim_separator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,19 @@ def dataset(tmpdir, request):
if which.startswith("static"):
project_root = pathlib.Path(zarr.__file__).resolve().parent.parent
if which.endswith("nested"):
return str(project_root / "fixture/nested")
static = project_root / "fixture/nested"
generator = NestedDirectoryStore
else:
return str(project_root / "fixture/flat")
static = project_root / "fixture/flat"
generator = DirectoryStore

if not static.exists(): # pragma: no cover
# store the data - should be one-time operation
s = generator(str(static))
a = zarr.open(store=s, mode="w", shape=(2, 2), dtype="<i8")
a[:] = [[1, 2], [3, 4]]

return str(static)

if which.startswith("directory"):
store_class = DirectoryStore
Expand Down

0 comments on commit 3a64977

Please sign in to comment.