Skip to content

Commit db9d16e

Browse files
maxrjonesd-v-b
authored andcommitted
Fix hatch matrix setup for minimal and optional dependencies (zarr-developers#2872)
* Run minimal tests without fsspec, requests, aiohttp * Retain existing test env names * Use importorskip * Specify which matrix config to upload codecov on * Remove redundant gpu env * Add obstore to min_deps definition * Fix optional dependency set * Add remote_tests set to doctest
1 parent 95a5d8c commit db9d16e

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
run: |
6565
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run-coverage
6666
- name: Upload coverage
67+
if: ${{ matrix.dependency-set == 'optional' && matrix.os == 'ubuntu-latest' }}
6768
uses: codecov/codecov-action@v5
6869
with:
6970
token: ${{ secrets.CODECOV_TOKEN }}

pyproject.toml

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,19 @@ gpu = [
7373
test = [
7474
"coverage",
7575
"pytest",
76+
"pytest-asyncio",
7677
"pytest-cov",
78+
"pytest-accept",
79+
"rich",
80+
"mypy",
81+
"hypothesis",
82+
]
83+
remote_tests = [
7784
'zarr[remote]',
7885
"botocore",
7986
"s3fs",
8087
"moto[s3,server]",
81-
"pytest-asyncio",
82-
"pytest-accept",
8388
"requests",
84-
"rich",
85-
"mypy",
86-
"hypothesis",
87-
"universal-pathlib",
8889
]
8990
optional = ["rich", "universal-pathlib"]
9091
docs = [
@@ -143,28 +144,21 @@ hooks.vcs.version-file = "src/zarr/_version.py"
143144
[tool.hatch.envs.test]
144145
dependencies = [
145146
"numpy~={matrix:numpy}",
146-
"universal_pathlib",
147147
]
148148
features = ["test"]
149149

150150
[[tool.hatch.envs.test.matrix]]
151151
python = ["3.11", "3.12", "3.13"]
152152
numpy = ["1.25", "2.1"]
153-
version = ["minimal"]
154-
155-
[[tool.hatch.envs.test.matrix]]
156-
python = ["3.11", "3.12", "3.13"]
157-
numpy = ["1.25", "2.1"]
158-
features = ["optional"]
153+
deps = ["minimal", "optional"]
159154

160-
[[tool.hatch.envs.test.matrix]]
161-
python = ["3.11", "3.12", "3.13"]
162-
numpy = ["1.25", "2.1"]
163-
features = ["gpu"]
155+
[tool.hatch.envs.test.overrides]
156+
matrix.deps.dependencies = [
157+
{value = "zarr[remote, remote_tests, test, optional]", if = ["optional"]}
158+
]
164159

165160
[tool.hatch.envs.test.scripts]
166161
run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy"
167-
run-coverage-gpu = "pip install cupy-cuda12x && pytest -m gpu --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy"
168162
run-coverage-html = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report html --cov=src"
169163
run = "run-coverage --no-cov"
170164
run-pytest = "run"
@@ -174,7 +168,7 @@ run-hypothesis = "run-coverage --hypothesis-profile ci --run-slow-hypothesis tes
174168
list-env = "pip list"
175169

176170
[tool.hatch.envs.doctest]
177-
features = ["test", "optional", "remote"]
171+
features = ["test", "optional", "remote", "remote_tests"]
178172
description = "Test environment for doctests"
179173

180174
[tool.hatch.envs.doctest.scripts]
@@ -255,6 +249,7 @@ dependencies = [
255249
'universal_pathlib==0.0.22',
256250
'typing_extensions==4.9.*',
257251
'donfig==0.8.*',
252+
'obstore==0.5.*',
258253
# test deps
259254
'zarr[test]',
260255
]

tests/test_store/test_core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ async def test_make_store_path_invalid() -> None:
121121

122122
async def test_make_store_path_fsspec(monkeypatch) -> None:
123123
pytest.importorskip("fsspec")
124+
pytest.importorskip("requests")
125+
pytest.importorskip("aiohttp")
124126
store_path = await make_store_path("http://foo.com/bar")
125127
assert isinstance(store_path.store, FsspecStore)
126128

0 commit comments

Comments
 (0)