Skip to content

Commit

Permalink
Upstream CI (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Mar 10, 2024
1 parent a75c4bc commit fe6f3db
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
pull_request:
branches: ['*']

# When this workflow is queued, automatically cancel any previous running
# or pending jobs from the same branch
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}
Expand Down Expand Up @@ -63,6 +69,10 @@ jobs:
- os: windows
python-version: '3.12'
requirements: no_optionals
# Test on nightly builds of requirements
- os: ubuntu
python-version: '3.12'
requirements: upstream

steps:
- name: Checkout
Expand All @@ -80,6 +90,20 @@ jobs:
environment-file: ci/requirements-${{ matrix.requirements }}.yml
activate-environment: recursive_diff

- name: Install nightly builds
if: ${{ matrix.requirements == 'upstream' }}
run: |
# Pick up https://github.com/mamba-org/mamba/pull/2903
mamba install -n base 'mamba>=1.5.2'
mamba uninstall --force numpy pandas scipy pyarrow
python -m pip install --no-deps --pre --prefer-binary \
--extra-index-url https://pypi.fury.io/arrow-nightlies/ \
pyarrow
python -m pip install --no-deps --pre \
-i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
numpy pandas scipy

- name: Show conda options
run: conda config --show

Expand Down
19 changes: 19 additions & 0 deletions ci/requirements-upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: recursive_diff
channels:
- conda-forge
dependencies:
- pytest
- pytest-cov
- packaging

- xarray
- dask
- h5netcdf # NetCDF engine
- scipy # NetCDF engine

- pip
- pip:
- git+https://github.com/dask/dask
- git+https://github.com/dask/distributed
- git+https://github.com/pydata/xarray
# numpy, pandas, pyarrow, and scipy are upgraded to nightly builds by pytest.yml
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ python_files = ["test_*.py"]
testpaths = ["recursive_diff/tests"]
filterwarnings = [
"error",
# Raised internally by pandas
'ignore:datetime.datetime.utcfromtimestamp\(\) is deprecated:DeprecationWarning',
# numpy <1.26 only
'ignore:elementwise comparison failed:DeprecationWarning',
'ignore:elementwise comparison failed:FutureWarning',
Expand Down
7 changes: 5 additions & 2 deletions recursive_diff/tests/test_recursive_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,16 @@ def test_xarray():
ds2.attrs["some2"] = 2
ds2.attrs["other"] = "someval"

# Older versions of xarray don't have the 'Size 24B' bit
d1_str = str(ds1["d1"].stack({"__stacked__": ["x"]})).splitlines()[0].strip()

check(
ds1,
ds2,
"[attrs]: Pair other:someval is in RHS only",
"[attrs][some2]: 1 != 2 (abs: 1.0e+00, rel: 1.0e+00)",
"[coords][nonindex][x=x2]: ni2 != ni4",
"[data_vars]: Pair d1:<xarray.DataArray 'd1' (__stacked__: 3)> ... is in LHS only", # noqa: E501
f"[data_vars]: Pair d1:{d1_str} ... is in LHS only",
"[data_vars][d2][x=x1, y=y1]: 4 != 10 (abs: 6.0e+00, rel: 1.5e+00)",
)

Expand All @@ -549,7 +552,7 @@ def test_xarray():
ds2,
"[attrs]: Pair other:someval is in RHS only",
"[coords][nonindex][x=x2]: ni2 != ni4",
"[data_vars]: Pair d1:<xarray.DataArray 'd1' (__stacked__: 3)> ... is in LHS only", # noqa: E501
f"[data_vars]: Pair d1:{d1_str} ... is in LHS only",
abs_tol=7,
)

Expand Down

0 comments on commit fe6f3db

Please sign in to comment.