Skip to content

Commit 8ad4cd6

Browse files
authored
Run fsspec tests in min_deps env (#2835)
* Run fsspec tests in min_deps env * Skip failing test
1 parent 48f7c9a commit 8ad4cd6

File tree

3 files changed

+29
-13
lines changed

3 files changed

+29
-13
lines changed

Diff for: .github/workflows/test.yml

+5
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ jobs:
102102
- name: Run Tests
103103
run: |
104104
hatch env run --env ${{ matrix.dependency-set }} run
105+
- name: Upload coverage
106+
uses: codecov/codecov-action@v5
107+
with:
108+
token: ${{ secrets.CODECOV_TOKEN }}
109+
verbose: true # optional (default = false)
105110

106111
doctests:
107112
name: doctests

Diff for: pyproject.toml

+8-11
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,7 @@ dependencies = [
212212
'typing_extensions @ git+https://github.com/python/typing_extensions',
213213
'donfig @ git+https://github.com/pytroll/donfig',
214214
# test deps
215-
'hypothesis',
216-
'pytest',
217-
'pytest-cov',
218-
'pytest-asyncio',
219-
'moto[s3]',
215+
'zarr[test]',
220216
]
221217

222218
[tool.hatch.envs.upstream.env-vars]
@@ -228,6 +224,9 @@ PIP_PRE = "1"
228224
run = "pytest --verbose"
229225
run-mypy = "mypy src"
230226
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
227+
run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy"
228+
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"
229+
run-coverage-html = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report html --cov=src"
231230
list-env = "pip list"
232231

233232
[tool.hatch.envs.min_deps]
@@ -247,18 +246,16 @@ dependencies = [
247246
'typing_extensions==4.9.*',
248247
'donfig==0.8.*',
249248
# test deps
250-
'hypothesis',
251-
'pytest',
252-
'pytest-cov',
253-
'pytest-asyncio',
254-
'moto[s3]',
249+
'zarr[test]',
255250
]
256251

257252
[tool.hatch.envs.min_deps.scripts]
258253
run = "pytest --verbose"
259254
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
260255
list-env = "pip list"
261-
256+
run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy"
257+
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"
258+
run-coverage-html = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report html --cov=src"
262259

263260
[tool.ruff]
264261
line-length = 100

Diff for: tests/test_store/test_fsspec.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@ class TestFsspecStoreS3(StoreTests[FsspecStore, cpu.Buffer]):
110110

111111
@pytest.fixture
112112
def store_kwargs(self, request) -> dict[str, str | bool]:
113-
fs, path = fsspec.url_to_fs(
113+
try:
114+
from fsspec import url_to_fs
115+
except ImportError:
116+
# before fsspec==2024.3.1
117+
from fsspec.core import url_to_fs
118+
fs, path = url_to_fs(
114119
f"s3://{test_bucket_name}", endpoint_url=endpoint_url, anon=False, asynchronous=True
115120
)
116121
return {"fs": fs, "path": path}
@@ -182,6 +187,10 @@ async def test_fsspec_store_from_uri(self, store: FsspecStore) -> None:
182187
)
183188
assert dict(group.attrs) == {"key": "value-3"}
184189

190+
@pytest.mark.skipif(
191+
parse_version(fsspec.__version__) < parse_version("2024.03.01"),
192+
reason="Prior bug in from_upath",
193+
)
185194
def test_from_upath(self) -> None:
186195
upath = pytest.importorskip("upath")
187196
path = upath.UPath(
@@ -204,7 +213,12 @@ def test_init_raises_if_path_has_scheme(self, store_kwargs) -> None:
204213
self.store_cls(**store_kwargs)
205214

206215
def test_init_warns_if_fs_asynchronous_is_false(self) -> None:
207-
fs, path = fsspec.url_to_fs(
216+
try:
217+
from fsspec import url_to_fs
218+
except ImportError:
219+
# before fsspec==2024.3.1
220+
from fsspec.core import url_to_fs
221+
fs, path = url_to_fs(
208222
f"s3://{test_bucket_name}", endpoint_url=endpoint_url, anon=False, asynchronous=False
209223
)
210224
store_kwargs = {"fs": fs, "path": path}

0 commit comments

Comments
 (0)