Skip to content

Commit 4a3bbf1

Browse files
test(ci): test on windows and osx (#2431)
* test(ci): test on windows and osx * add os to name * bail on making np upper bound super flexible * remove lmdb * remove types-redis * fixup * tweak timeout * to_posix in LocalStore * no mo windows * Update src/zarr/storage/local.py * Update .github/workflows/test.yml * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent f4af51c commit 4a3bbf1

File tree

7 files changed

+37
-21
lines changed

7 files changed

+37
-21
lines changed

.github/workflows/gpu_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
matrix:
2727
python-version: ['3.11']
28-
numpy-version: ['2.0']
28+
numpy-version: ['2.1']
2929
dependency-set: ["minimal"]
3030

3131
steps:

.github/workflows/hypothesis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
matrix:
2828
python-version: ['3.11']
29-
numpy-version: ['1.26']
29+
numpy-version: ['2.1']
3030
dependency-set: ["optional"]
3131

3232
steps:

.github/workflows/test.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,33 @@ concurrency:
1616

1717
jobs:
1818
test:
19-
name: py=${{ matrix.python-version }}, np=${{ matrix.numpy-version }}, deps=${{ matrix.dependency-set }}
19+
name: os=${{ matrix.os }}, py=${{ matrix.python-version }}, np=${{ matrix.numpy-version }}, deps=${{ matrix.dependency-set }}
2020

21-
runs-on: ubuntu-latest
2221
strategy:
2322
matrix:
2423
python-version: ['3.11', '3.12', '3.13']
25-
numpy-version: ['1.25', '1.26', '2.0']
24+
numpy-version: ['1.25', '2.1']
2625
dependency-set: ["minimal", "optional"]
26+
os: ["ubuntu-latest"]
27+
include:
28+
- python-version: '3.11'
29+
numpy-version: '1.25'
30+
dependency-set: 'optional'
31+
os: 'macos-latest'
32+
- python-version: '3.13'
33+
numpy-version: '2.1'
34+
dependency-set: 'optional'
35+
os: 'macos-latest'
36+
# https://github.com/zarr-developers/zarr-python/issues/2438
37+
# - python-version: '3.11'
38+
# numpy-version: '1.25'
39+
# dependency-set: 'optional'
40+
# os: 'windows-latest'
41+
# - python-version: '3.13'
42+
# numpy-version: '2.1'
43+
# dependency-set: 'optional'
44+
# os: 'windows-latest'
45+
runs-on: ${{ matrix.os }}
2746

2847
steps:
2948
- uses: actions/checkout@v4

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ repos:
3737
- universal-pathlib
3838
# Tests
3939
- pytest
40-
# Zarr v2
41-
- types-redis
4240
- repo: https://github.com/scientific-python/cookie
4341
rev: 2024.08.19
4442
hooks:

pyproject.toml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ test = [
6161
"pytest",
6262
"pytest-cov",
6363
"msgpack",
64-
"lmdb",
6564
"s3fs",
6665
"pytest-asyncio",
6766
"moto[s3]",
@@ -92,13 +91,11 @@ docs = [
9291
'numpydoc',
9392
'numcodecs[msgpack]',
9493
'msgpack',
95-
'lmdb',
9694
]
9795
extra = [
9896
'msgpack',
9997
]
10098
optional = [
101-
'lmdb',
10299
'universal-pathlib>=0.0.22',
103100
]
104101

@@ -135,17 +132,17 @@ features = ["test", "extra"]
135132

136133
[[tool.hatch.envs.test.matrix]]
137134
python = ["3.11", "3.12", "3.13"]
138-
numpy = ["1.25", "1.26", "2.0"]
135+
numpy = ["1.25", "2.1"]
139136
version = ["minimal"]
140137

141138
[[tool.hatch.envs.test.matrix]]
142139
python = ["3.11", "3.12", "3.13"]
143-
numpy = ["1.25", "1.26", "2.0"]
140+
numpy = ["1.25", "2.1"]
144141
features = ["optional"]
145142

146143
[[tool.hatch.envs.test.matrix]]
147144
python = ["3.11", "3.12", "3.13"]
148-
numpy = ["1.25", "1.26", "2.0"]
145+
numpy = ["1.25", "2.1"]
149146
features = ["gpu"]
150147

151148
[tool.hatch.envs.test.scripts]
@@ -166,7 +163,7 @@ features = ["test", "extra", "gpu"]
166163

167164
[[tool.hatch.envs.gputest.matrix]]
168165
python = ["3.11", "3.12", "3.13"]
169-
numpy = ["1.25", "1.26", "2.0"]
166+
numpy = ["1.25", "2.1"]
170167
version = ["minimal"]
171168

172169
[tool.hatch.envs.gputest.scripts]

src/zarr/storage/local.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,19 @@ async def exists(self, key: str) -> bool:
219219

220220
async def list(self) -> AsyncGenerator[str, None]:
221221
# docstring inherited
222-
to_strip = str(self.root) + "/"
222+
to_strip = self.root.as_posix() + "/"
223223
for p in list(self.root.rglob("*")):
224224
if p.is_file():
225-
yield str(p).replace(to_strip, "")
225+
yield p.as_posix().replace(to_strip, "")
226226

227227
async def list_prefix(self, prefix: str) -> AsyncGenerator[str, None]:
228228
# docstring inherited
229-
to_strip = os.path.join(str(self.root / prefix))
229+
to_strip = (
230+
(self.root / prefix).as_posix() + "/"
231+
) # TODO: fixme in https://github.com/zarr-developers/zarr-python/issues/2438
230232
for p in (self.root / prefix).rglob("*"):
231233
if p.is_file():
232-
yield str(p.relative_to(to_strip))
234+
yield p.as_posix().replace(to_strip, "")
233235

234236
async def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
235237
# docstring inherited
@@ -239,6 +241,6 @@ async def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
239241
try:
240242
key_iter = base.iterdir()
241243
for key in key_iter:
242-
yield str(key).replace(to_strip, "")
244+
yield key.as_posix().replace(to_strip, "")
243245
except (FileNotFoundError, NotADirectoryError):
244246
pass

tests/test_sync.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ def test_sync_raises(sync_loop: asyncio.AbstractEventLoop | None) -> None:
6161

6262

6363
def test_sync_timeout() -> None:
64-
duration = 0.002
64+
duration = 0.02
6565

6666
async def foo() -> None:
6767
await asyncio.sleep(duration)
6868

6969
with pytest.raises(asyncio.TimeoutError):
70-
sync(foo(), timeout=duration / 2)
70+
sync(foo(), timeout=duration / 10)
7171

7272

7373
def test_sync_raises_if_no_coroutine(sync_loop: asyncio.AbstractEventLoop | None) -> None:

0 commit comments

Comments
 (0)