Skip to content

Commit 85c9a40

Browse files
authored
CI environments overhaul (#3340)
* Rationalize and align CI environments. Add many optional dependencies to individual CI suites. * pynio and cdms2 are not available on Windows * cfgrib causes Python interpreter crash on Windows * dtype of np.arange defaults to int64 on Linux and int32 on Windows * Suppress failure to delete file on Windows * Mark hypotesis tests as @slow
1 parent e1183e8 commit 85c9a40

File tree

11 files changed

+85
-91
lines changed

11 files changed

+85
-91
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
py37-upstream-dev:
1818
conda_env: py37
1919
upstream_dev: true
20-
py36-flakey:
20+
py36-flaky:
2121
conda_env: py36
2222
pytest_extra_flags: --run-flaky --run-network-tests
2323
allow_failure: true
@@ -90,15 +90,3 @@ jobs:
9090
cd doc
9191
sphinx-build -n -j auto -b html -d _build/doctrees . _build/html
9292
displayName: Build HTML docs
93-
94-
- job: LinuxHypothesis
95-
variables:
96-
conda_env: py36-hypothesis
97-
pool:
98-
vmImage: 'ubuntu-16.04'
99-
steps:
100-
- template: ci/azure/install.yml
101-
- bash: |
102-
source activate xarray-tests
103-
pytest properties
104-
displayName: Property based tests

ci/azure/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ steps:
1111
# https://github.com/microsoft/azure-pipelines-tasks/issues/9302
1212
- bash: |
1313
source activate xarray-tests
14-
pytest xarray \
14+
pytest \
1515
--junitxml=junit/test-results.xml \
1616
--cov=xarray \
1717
--cov-report=xml \

ci/requirements/py36-hypothesis.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

ci/requirements/py36.yml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,40 @@ channels:
33
- conda-forge
44
dependencies:
55
- python=3.6
6+
- black
7+
- boto3
8+
- bottleneck
9+
- cdms2
10+
- cfgrib>=0.9.2
611
- cftime
12+
- coveralls
713
- dask
814
- distributed
9-
- h5py
15+
- flake8
1016
- h5netcdf
17+
- h5py
18+
- hypothesis
19+
- iris>=1.10
20+
- lxml
1121
- matplotlib
12-
- netcdf4
13-
- pytest
14-
- pytest-cov
15-
- pytest-env
16-
- coveralls
17-
- flake8
1822
- mypy==0.720 # Must match .pre-commit-config.yaml
23+
- nc-time-axis
24+
- netcdf4
25+
- numba
1926
- numpy>=1.12
2027
- pandas>=0.19
2128
- pip
29+
- pseudonetcdf>=3.0.1
30+
- pydap
31+
- pynio
32+
- pytest
33+
- pytest-cov
34+
- pytest-env
35+
- rasterio
2236
- scipy
2337
- seaborn
38+
- sparse
2439
- toolz
25-
- rasterio
26-
- boto3
27-
- bottleneck
2840
- zarr
29-
- pseudonetcdf>=3.0.1
30-
- cfgrib>=0.9.2
31-
- cdms2
32-
# Disabled due to conflicting dependencies:
33-
# https://github.com/pydata/xarray/issues/3154
34-
# - pynio
35-
- iris>=1.10
36-
- pydap
37-
- lxml
38-
41+
- pip:
42+
- numbagg

ci/requirements/py37-windows.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,40 @@ channels:
33
- conda-forge
44
dependencies:
55
- python=3.7
6+
- black
7+
- boto3
8+
- bottleneck
9+
# - cdms2 # Not available on Windows
10+
# - cfgrib>=0.9.2 # Causes Python interpreter crash on Windows
611
- cftime
7-
- nc-time-axis
12+
- coveralls
813
- dask
914
- distributed
10-
- h5py
15+
- flake8
1116
- h5netcdf
17+
- h5py
18+
- hypothesis
19+
- iris>=1.10
20+
- lxml
1221
- matplotlib
22+
- mypy==0.720 # Must match .pre-commit-config.yaml
23+
- nc-time-axis
1324
- netcdf4
14-
- pytest
15-
- pytest-cov
16-
- pytest-env
17-
- coveralls
25+
- numba
1826
- numpy>=1.12
1927
- pandas>=0.19
2028
- pip
29+
- pseudonetcdf>=3.0.1
30+
- pydap
31+
# - pynio # Not available on Windows
32+
- pytest
33+
- pytest-cov
34+
- pytest-env
35+
- rasterio
2136
- scipy
2237
- seaborn
38+
- sparse
2339
- toolz
24-
- rasterio
25-
- boto3
2640
- zarr
41+
- pip:
42+
- numbagg

ci/requirements/py37.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,40 @@ channels:
33
- conda-forge
44
dependencies:
55
- python=3.7
6+
- black
7+
- boto3
8+
- bottleneck
9+
- cdms2
10+
- cfgrib>=0.9.2
611
- cftime
7-
- nc-time-axis
12+
- coveralls
813
- dask
914
- distributed
10-
- h5py
15+
- flake8
1116
- h5netcdf
17+
- h5py
18+
- hypothesis
19+
- iris>=1.10
20+
- lxml
1221
- matplotlib
13-
- netcdf4
14-
- pytest
15-
- pytest-cov
16-
- pytest-env
17-
- coveralls
18-
- flake8
1922
- mypy==0.720 # Must match .pre-commit-config.yaml
23+
- nc-time-axis
24+
- netcdf4
25+
- numba
2026
- numpy>=1.12
2127
- pandas>=0.19
2228
- pip
29+
- pseudonetcdf>=3.0.1
30+
- pydap
31+
- pynio
32+
- pytest
33+
- pytest-cov
34+
- pytest-env
35+
- rasterio
2336
- scipy
2437
- seaborn
2538
- sparse
2639
- toolz
27-
- rasterio
28-
- boto3
29-
- bottleneck
3040
- zarr
31-
- pseudonetcdf>=3.0.1
32-
- cfgrib>=0.9.2
33-
- lxml
34-
- pydap
3541
- pip:
3642
- numbagg

properties/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This directory contains property-based tests using a library
44
called [Hypothesis](https://github.com/HypothesisWorks/hypothesis-python).
55

6-
The property tests for Xarray are a work in progress - more are always welcome.
6+
The property tests for xarray are a work in progress - more are always welcome.
77
They are stored in a separate directory because they tend to run more examples
88
and thus take longer, and so that local development can run a test suite
99
without needing to `pip install hypothesis`.

properties/test_encode_decode.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
These ones pass, just as you'd hope!
55
66
"""
7+
import pytest
8+
9+
pytest.importorskip("hypothesis")
10+
711
import hypothesis.extra.numpy as npst
812
import hypothesis.strategies as st
913
from hypothesis import given, settings
@@ -23,6 +27,7 @@
2327
)
2428

2529

30+
@pytest.mark.slow
2631
@given(st.data(), an_array)
2732
def test_CFMask_coder_roundtrip(data, arr):
2833
names = data.draw(
@@ -36,6 +41,7 @@ def test_CFMask_coder_roundtrip(data, arr):
3641
xr.testing.assert_identical(original, roundtripped)
3742

3843

44+
@pytest.mark.slow
3945
@given(st.data(), an_array)
4046
def test_CFScaleOffset_coder_roundtrip(data, arr):
4147
names = data.draw(

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ universal = 1
33

44
[tool:pytest]
55
python_files=test_*.py
6-
testpaths=xarray/tests
6+
testpaths=xarray/tests properties
77
# Fixed upstream in https://github.com/kwgoodman/bottleneck/pull/199
88
filterwarnings =
99
ignore:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning

xarray/tests/test_backends.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3487,7 +3487,10 @@ def test_uamiv_format_write(self):
34873487
"example.uamiv", engine="pseudonetcdf", backend_kwargs=fmtkw
34883488
)
34893489
with self.roundtrip(
3490-
expected, save_kwargs=fmtkw, open_kwargs={"backend_kwargs": fmtkw}
3490+
expected,
3491+
save_kwargs=fmtkw,
3492+
open_kwargs={"backend_kwargs": fmtkw},
3493+
allow_cleanup_failure=True,
34913494
) as actual:
34923495
assert_identical(expected, actual)
34933496

xarray/tests/test_sparse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ def test_dataarray_repr(self):
656656
a = xr.DataArray(
657657
sparse.COO.from_numpy(np.ones(4)),
658658
dims=["x"],
659-
coords={"y": ("x", sparse.COO.from_numpy(np.arange(4)))},
659+
coords={"y": ("x", sparse.COO.from_numpy(np.arange(4, dtype="i8")))},
660660
)
661661
expected = dedent(
662662
"""\
@@ -671,7 +671,7 @@ def test_dataarray_repr(self):
671671
def test_dataset_repr(self):
672672
ds = xr.Dataset(
673673
data_vars={"a": ("x", sparse.COO.from_numpy(np.ones(4)))},
674-
coords={"y": ("x", sparse.COO.from_numpy(np.arange(4)))},
674+
coords={"y": ("x", sparse.COO.from_numpy(np.arange(4, dtype="i8")))},
675675
)
676676
expected = dedent(
677677
"""\

0 commit comments

Comments
 (0)