Skip to content

Commit 6ad2ca6

Browse files
committed
use tmpdir for test
1 parent 8aadd15 commit 6ad2ca6

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

tests/v2/test_storage.py

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,38 +2227,38 @@ def test_format_compatibility():
22272227
np.random.seed(42)
22282228

22292229
arrays_chunks = [
2230-
(np.arange(1111, dtype="<i1"), 100),
2231-
(np.arange(1111, dtype="<i2"), 100),
2232-
(np.arange(1111, dtype="<i4"), 100),
2233-
(np.arange(1111, dtype="<i8"), 1000),
2230+
(np.arange(1111, dtype="<i1"), 600),
2231+
(np.arange(1111, dtype="<i2"), 600),
2232+
(np.arange(1111, dtype="<i4"), 600),
2233+
(np.arange(1111, dtype="<i8"), 600),
22342234
(np.random.randint(0, 200, size=2222, dtype="u1").astype("<u1"), 100),
2235-
(np.random.randint(0, 2000, size=2222, dtype="u2").astype("<u2"), 100),
2236-
(np.random.randint(0, 2000, size=2222, dtype="u4").astype("<u4"), 100),
2237-
(np.random.randint(0, 2000, size=2222, dtype="u8").astype("<u8"), 100),
2238-
(np.linspace(0, 1, 3333, dtype="<f2"), 100),
2239-
(np.linspace(0, 1, 3333, dtype="<f4"), 100),
2240-
(np.linspace(0, 1, 3333, dtype="<f8"), 100),
2241-
(np.random.normal(loc=0, scale=1, size=4444).astype("<f2"), 100),
2242-
(np.random.normal(loc=0, scale=1, size=4444).astype("<f4"), 100),
2243-
(np.random.normal(loc=0, scale=1, size=4444).astype("<f8"), 100),
2244-
(np.random.choice([b"A", b"C", b"G", b"T"], size=5555, replace=True).astype("S"), 100),
2235+
(np.random.randint(0, 2000, size=2222, dtype="u2").astype("<u2"), 1000),
2236+
(np.random.randint(0, 2000, size=2222, dtype="u4").astype("<u4"), 1000),
2237+
(np.random.randint(0, 2000, size=2222, dtype="u8").astype("<u8"), 1000),
2238+
(np.linspace(0, 1, 3333, dtype="<f2"), 600),
2239+
(np.linspace(0, 1, 3333, dtype="<f4"), 600),
2240+
(np.linspace(0, 1, 3333, dtype="<f8"), 600),
2241+
(np.random.normal(loc=0, scale=1, size=4444).astype("<f2"), 3000),
2242+
(np.random.normal(loc=0, scale=1, size=4444).astype("<f4"), 3000),
2243+
(np.random.normal(loc=0, scale=1, size=4444).astype("<f8"), 3000),
2244+
(np.random.choice([b"A", b"C", b"G", b"T"], size=5555, replace=True).astype("S"), 3000),
22452245
(
22462246
np.random.choice(["foo", "bar", "baz", "quux"], size=5555, replace=True).astype("<U"),
2247-
100,
2247+
3000,
22482248
),
22492249
(
22502250
np.random.choice([0, 1 / 3, 1 / 7, 1 / 9, np.nan], size=5555, replace=True).astype(
22512251
"<f8"
22522252
),
2253-
100,
2253+
3000,
22542254
),
2255-
(np.random.randint(0, 2, size=5555, dtype=bool), 100),
2256-
(np.arange(20000, dtype="<i4").reshape(2000, 10, order="C"), (100, 3)),
2257-
(np.arange(20000, dtype="<i4").reshape(200, 100, order="F"), (100, 30)),
2258-
(np.arange(20000, dtype="<i4").reshape(200, 10, 10, order="C"), (100, 3, 3)),
2259-
(np.arange(20000, dtype="<i4").reshape(20, 100, 10, order="F"), (10, 30, 3)),
2260-
(np.arange(20000, dtype="<i4").reshape(20, 10, 10, 10, order="C"), (10, 3, 3, 3)),
2261-
(np.arange(20000, dtype="<i4").reshape(20, 10, 10, 10, order="F"), (10, 3, 3, 3)),
2255+
(np.random.randint(0, 2, size=5555, dtype=bool), 3000),
2256+
(np.arange(20000, dtype="<i4").reshape(2000, 10, order="C"), (2000, 5)),
2257+
(np.arange(20000, dtype="<i4").reshape(200, 100, order="F"), (200, 50)),
2258+
(np.arange(20000, dtype="<i4").reshape(200, 10, 10, order="C"), (200, 10, 5)),
2259+
(np.arange(20000, dtype="<i4").reshape(20, 100, 10, order="F"), (20, 100, 5)),
2260+
(np.arange(20000, dtype="<i4").reshape(20, 10, 10, 10, order="C"), (20, 10, 10, 5)),
2261+
(np.arange(20000, dtype="<i4").reshape(20, 10, 10, 10, order="F"), (20, 10, 10, 5)),
22622262
]
22632263

22642264
compressors = [
@@ -2280,9 +2280,9 @@ def test_format_compatibility():
22802280
for j, compressor in enumerate(compressors):
22812281
path = "{}/{}".format(i, j)
22822282

2283-
if path not in fixture: # pragma: no cover
2283+
#if path not in fixture: # pragma: no cover
22842284
# store the data - should be one-time operation
2285-
fixture.array(path, data=arr, chunks=chunks, order=order, compressor=compressor)
2285+
# fixture.array(path, data=arr, chunks=chunks, order=order, compressor=compressor)
22862286

22872287
# setup array
22882288
z = fixture[path]
@@ -2457,13 +2457,12 @@ def test_normalize_store_arg(tmpdir):
24572457
assert isinstance(store, FSStore)
24582458

24592459

2460-
def test_meta_prefix_6853():
2461-
fixture = pathlib.Path(zarr.v2.__file__).resolve().parent.parent / "fixture"
2460+
def test_meta_prefix_6853(tmpdir):
2461+
fixture = pathlib.Path(str(tmpdir)) / "fixture"
24622462
meta = fixture / "meta"
2463-
if not meta.exists(): # pragma: no cover
2464-
s = DirectoryStore(str(meta), dimension_separator=".")
2465-
a = zarr.v2.open(store=s, mode="w", shape=(2, 2), dtype="<i8")
2466-
a[:] = [[1, 2], [3, 4]]
2463+
s = DirectoryStore(str(meta), dimension_separator=".")
2464+
a = zarr.v2.open(store=s, mode="w", shape=(2, 2), dtype="<i8")
2465+
a[:] = [[1, 2], [3, 4]]
24672466

24682467
fixtures = group(store=DirectoryStore(str(fixture)))
24692468
assert list(fixtures.arrays())

0 commit comments

Comments
 (0)