Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(ci): test on windows and osx #2431

Merged
merged 14 commits into from
Oct 24, 2024
2 changes: 1 addition & 1 deletion .github/workflows/gpu_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
matrix:
python-version: ['3.11']
numpy-version: ['2.0']
numpy-version: ['2.1']
dependency-set: ["minimal"]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hypothesis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
matrix:
python-version: ['3.11']
numpy-version: ['1.26']
numpy-version: ['2.1']
dependency-set: ["optional"]

steps:
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,32 @@ concurrency:

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

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12', '3.13']
numpy-version: ['1.25', '1.26', '2.0']
numpy-version: ['1.25', '2.1']
dependency-set: ["minimal", "optional"]
os: ["ubuntu-latest"]
include:
- python-version: '3.11'
numpy-version: '1.25'
dependency-set: 'optional'
os: 'macos-latest'
- python-version: '3.13'
numpy-version: '2.1'
dependency-set: 'optional'
os: 'macos-latest'
# - python-version: '3.11'
jhamman marked this conversation as resolved.
Show resolved Hide resolved
# numpy-version: '1.25'
# dependency-set: 'optional'
# os: 'windows-latest'
# - python-version: '3.13'
# numpy-version: '2.1'
# dependency-set: 'optional'
# os: 'windows-latest'
Comment on lines +37 to +44
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened a dedicated ticket for this: #2438

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ repos:
- universal-pathlib
# Tests
- pytest
# Zarr v2
- types-redis
- repo: https://github.com/scientific-python/cookie
rev: 2024.08.19
hooks:
Expand Down
11 changes: 4 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ test = [
"pytest",
"pytest-cov",
"msgpack",
"lmdb",
"s3fs",
"pytest-asyncio",
"moto[s3]",
Expand Down Expand Up @@ -92,13 +91,11 @@ docs = [
'numpydoc',
'numcodecs[msgpack]',
'msgpack',
'lmdb',
]
extra = [
'msgpack',
]
optional = [
'lmdb',
'universal-pathlib>=0.0.22',
]

Expand Down Expand Up @@ -135,17 +132,17 @@ features = ["test", "extra"]

[[tool.hatch.envs.test.matrix]]
python = ["3.11", "3.12", "3.13"]
numpy = ["1.25", "1.26", "2.0"]
numpy = ["1.25", "2.1"]
version = ["minimal"]

[[tool.hatch.envs.test.matrix]]
python = ["3.11", "3.12", "3.13"]
numpy = ["1.25", "1.26", "2.0"]
numpy = ["1.25", "2.1"]
features = ["optional"]

[[tool.hatch.envs.test.matrix]]
python = ["3.11", "3.12", "3.13"]
numpy = ["1.25", "1.26", "2.0"]
numpy = ["1.25", "2.1"]
features = ["gpu"]

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

[[tool.hatch.envs.gputest.matrix]]
python = ["3.11", "3.12", "3.13"]
numpy = ["1.25", "1.26", "2.0"]
numpy = ["1.25", "2.1"]
version = ["minimal"]

[tool.hatch.envs.gputest.scripts]
Expand Down
10 changes: 5 additions & 5 deletions src/zarr/storage/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,17 @@ async def exists(self, key: str) -> bool:

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

async def list_prefix(self, prefix: str) -> AsyncGenerator[str, None]:
# docstring inherited
to_strip = os.path.join(str(self.root / prefix))
to_strip = (self.root / prefix).as_posix() + "/" # TODO: fixme in 2430
jhamman marked this conversation as resolved.
Show resolved Hide resolved
jhamman marked this conversation as resolved.
Show resolved Hide resolved
for p in (self.root / prefix).rglob("*"):
if p.is_file():
yield str(p.relative_to(to_strip))
yield p.as_posix().replace(to_strip, "")

async def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
# docstring inherited
Expand All @@ -239,6 +239,6 @@ async def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
try:
key_iter = base.iterdir()
for key in key_iter:
yield str(key).replace(to_strip, "")
yield key.as_posix().replace(to_strip, "")
except (FileNotFoundError, NotADirectoryError):
pass
4 changes: 2 additions & 2 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ def test_sync_raises(sync_loop: asyncio.AbstractEventLoop | None) -> None:


def test_sync_timeout() -> None:
duration = 0.002
duration = 0.02

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

with pytest.raises(asyncio.TimeoutError):
sync(foo(), timeout=duration / 2)
sync(foo(), timeout=duration / 10)


def test_sync_raises_if_no_coroutine(sync_loop: asyncio.AbstractEventLoop | None) -> None:
Expand Down
Loading