Skip to content

Commit c22fe17

Browse files
authored
Fix mypy, min-versions CI, xfail Zarr tests (#10255)
1 parent 888dfdb commit c22fe17

File tree

7 files changed

+33
-5
lines changed

7 files changed

+33
-5
lines changed

ci/minimum_versions.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020

2121
channels = ["conda-forge"]
2222
platforms = ["noarch", "linux-64"]
23+
# these packages don't fail the CI, but will be printed in the report
24+
ignore_failure_packages = [
25+
# remove when we can pin to pydap 3.5.1 without error
26+
"pydap",
27+
]
28+
# these packages are completely ignored
2329
ignored_packages = [
2430
"coveralls",
2531
"pip",
@@ -171,7 +177,11 @@ def compare_versions(environments, policy_versions):
171177
status = {}
172178
for env, specs in environments.items():
173179
env_status = any(
174-
spec.version > policy_versions[spec.name].version for spec in specs
180+
(
181+
(spec.version > policy_versions[spec.name].version)
182+
and (spec.name not in ignore_failure_packages)
183+
)
184+
for spec in specs
175185
)
176186
status[env] = env_status
177187
return status

ci/requirements/min-all-deps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dependencies:
4242
- pandas=2.1
4343
- pint=0.22
4444
- pip
45-
- pydap=3.5.0
45+
- pydap=3.5
4646
- pytest
4747
- pytest-cov
4848
- pytest-env

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ filterwarnings = [
346346
"default:the `pandas.MultiIndex` object:FutureWarning:xarray.tests.test_variable",
347347
"default:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning",
348348
"default:Duplicate dimension names present:UserWarning:xarray.namedarray.core",
349+
# Zarr 2 V3 implementation
350+
"ignore:Zarr-Python is not in alignment with the final V3 specification",
349351
# TODO: this is raised for vlen-utf8, consolidated metadata, U1 dtype
350352
"ignore:is currently not part .* the Zarr version 3 specification.",
351353
# TODO: remove once we know how to deal with a changed signature in protocols

xarray/tests/test_backends.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,6 +2320,9 @@ def roundtrip(
23202320
with self.open(store_target, **open_kwargs) as ds:
23212321
yield ds
23222322

2323+
def test_roundtrip_bytes_with_fill_value(self):
2324+
pytest.xfail("Broken by Zarr 3.0.7")
2325+
23232326
@pytest.mark.parametrize("consolidated", [False, True, None])
23242327
def test_roundtrip_consolidated(self, consolidated) -> None:
23252328
expected = create_test_data()
@@ -3548,6 +3551,10 @@ def test_append(self) -> None:
35483551
)
35493552

35503553
@requires_dask
3554+
@pytest.mark.skipif(
3555+
sys.version_info.major == 3 and sys.version_info.minor < 11,
3556+
reason="zarr too old",
3557+
)
35513558
def test_region_write(self) -> None:
35523559
ds = Dataset({"foo": ("x", [1, 2, 3])}, coords={"x": [1, 2, 3]}).chunk()
35533560
with self.create_zarr_target() as store:

xarray/tests/test_dataarray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3608,8 +3608,8 @@ def test_to_and_from_dict(
36083608
return_data = array.to_numpy()
36093609
coords_data = np.array(["a", "b"])
36103610
if data == "list" or data is True:
3611-
return_data = return_data.tolist() # type:ignore[assignment]
3612-
coords_data = coords_data.tolist() # type:ignore[assignment]
3611+
return_data = return_data.tolist()
3612+
coords_data = coords_data.tolist()
36133613

36143614
expected: dict[str, Any] = {
36153615
"name": "foo",

xarray/tests/test_duck_array_wrapping.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@
101101
},
102102
}
103103

104+
try:
105+
import jax
106+
107+
# enable double-precision
108+
jax.config.update("jax_enable_x64", True)
109+
except ImportError:
110+
pass
111+
104112

105113
class _BaseTest:
106114
def setup_for_test(self, request, namespace):

xarray/tests/test_variable.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2444,7 +2444,8 @@ def test_to_index(self):
24442444

24452445
def test_to_index_multiindex_level(self):
24462446
midx = pd.MultiIndex.from_product([["a", "b"], [1, 2]], names=("one", "two"))
2447-
ds = Dataset(coords={"x": midx})
2447+
with pytest.warns(FutureWarning):
2448+
ds = Dataset(coords={"x": midx})
24482449
assert ds.one.variable.to_index().equals(midx.get_level_values("one"))
24492450

24502451
def test_multiindex_default_level_names(self):

0 commit comments

Comments
 (0)