Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stateful tests with Dataset #8658

Merged
merged 72 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
aa5653f
Stateful tests with Dataset
dcherian Jan 24, 2024
f1199a1
Disable check_default_indexes when needed
dcherian Jan 26, 2024
3fdb188
Add Zarr roundtrip
dcherian Jan 26, 2024
0820323
Randomize dimension choice
dcherian Jan 26, 2024
06bdbf8
Fix a bug
dcherian Jan 26, 2024
2710a4e
Add reset_index
dcherian Jan 26, 2024
85ab186
Add stack, unstack
dcherian Jan 26, 2024
443916c
[revert] Disable Zarr till we control attrs strategy
dcherian Jan 26, 2024
5c00585
Try making unique names
dcherian Jan 26, 2024
04b6b92
Share names strategy to ensure uniques?
dcherian Jan 26, 2024
a4a4c43
cleanup
dcherian Jan 26, 2024
83fa17b
Try sharing strategies better
dcherian Jan 26, 2024
491b9b1
Fix endianness
dcherian Jan 26, 2024
c648cfd
Better swap_dims
dcherian Jan 26, 2024
06763c2
More improvements
dcherian Mar 9, 2024
c07688c
WIP
dcherian Mar 13, 2024
e30a89f
Drop duplicates before unstacking
dcherian Mar 15, 2024
316eb43
Add reset_index
dcherian Mar 15, 2024
88e2010
Better duplicate assumption
dcherian Mar 15, 2024
3c92ddf
Merge branch 'main' into state-machine
dcherian Mar 15, 2024
6c23b49
Move
dcherian Mar 15, 2024
2c671e3
Fix reset_index
dcherian Mar 15, 2024
ae5f4d5
Skip if hypothesis not installed
dcherian Mar 15, 2024
3cfed5e
Better precondition around reset_index
dcherian Mar 15, 2024
209a2ff
Note
dcherian Mar 16, 2024
0be7c75
Try a bundle
dcherian Mar 18, 2024
6dcbd48
Use unique_subset_of
dcherian Mar 18, 2024
0fabd6b
Use Bundles more
dcherian Mar 18, 2024
e65a7a9
Add index_variables strategy
dcherian Mar 18, 2024
9825937
Small improvement
dcherian Mar 18, 2024
d933be3
fix
dcherian Mar 18, 2024
50f6030
Use st.shared
dcherian Mar 19, 2024
4905b1c
Revert "Use st.shared"
dcherian Mar 19, 2024
4391833
fix unstacking
dcherian Mar 19, 2024
dcc2e48
cleanup
dcherian Mar 21, 2024
01e0670
WIP
dcherian Mar 25, 2024
360b926
Remove bundles
dcherian Mar 29, 2024
de1d1e4
Fixes
dcherian Mar 29, 2024
ef51ad4
Add hypothesis cache to CI
dcherian Mar 29, 2024
829f80c
Prevent index variables with NaNs, infs
dcherian Mar 29, 2024
6a38e27
[revert]
dcherian Mar 29, 2024
ffb3d83
Always save hypothesis cache
dcherian Mar 29, 2024
b332390
Expand dtypes
dcherian Mar 30, 2024
4a958dc
Add invariant check for #8646
dcherian Mar 30, 2024
2d5ea84
Add drop_dims
dcherian Mar 31, 2024
35b8656
Add create_index to stack
dcherian Mar 31, 2024
a4974c2
Generalize a bit
dcherian Mar 31, 2024
7e98388
limit number of indexes to stack
dcherian Mar 31, 2024
0762a9f
Fix endianness?
dcherian Mar 31, 2024
ef7cfdd
uniquify drop_dims
dcherian Mar 31, 2024
18b0d6f
Avoid NaTs in index vars
dcherian Mar 31, 2024
de53f93
Guard swap_dims
dcherian Mar 31, 2024
6f0a016
Revert "Add invariant check for #8646"
dcherian Mar 31, 2024
dd2e151
Add drop_indexes
dcherian Mar 31, 2024
a5a873b
Add assign_coords
dcherian Mar 31, 2024
87db79a
Fix max_period for pandas timedelta
dcherian Mar 31, 2024
4d35d56
Add xfailed test
dcherian Mar 31, 2024
d8e00d3
Add notes
dcherian Mar 31, 2024
06808a1
Skip timedelta indexes
dcherian Mar 31, 2024
cf9e86a
to_zarr
dcherian Apr 1, 2024
e5333fa
small tweaks
dcherian Apr 1, 2024
b85f5e8
Remove NaT assume
dcherian Apr 1, 2024
15e00ff
Revert "[revert]"
dcherian Apr 1, 2024
082d9f6
Add hypothesis workflow
dcherian Apr 1, 2024
b9433b6
Swtich out
dcherian Apr 2, 2024
a216531
fix
dcherian Apr 2, 2024
4399d96
Merge branch 'main' into state-machine
dcherian Apr 2, 2024
d2af875
Use st.builds
dcherian Apr 2, 2024
5aae971
cleanup
dcherian Apr 2, 2024
7d8b6ff
Add initialize
dcherian Apr 2, 2024
926bf54
review feedback
dcherian Apr 3, 2024
7cbfc9c
Merge branch 'main' into state-machine
dcherian Apr 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ jobs:
runs-on: "ubuntu-latest"
needs: detect-ci-trigger
if: needs.detect-ci-trigger.outputs.triggered == 'false'

defaults:
run:
shell: bash -l {0}

env:
CONDA_ENV_FILE: ci/requirements/environment.yml
PYTHON_VERSION: "3.11"

steps:
- uses: actions/checkout@v4
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ jobs:
run: |
python -c "import xarray"

- name: Restore cached hypothesis directory
uses: actions/cache@v4
with:
path: .hypothesis/
key: cache-hypothesis
enableCrossOsArchive: true
save-always: true

- name: Run tests
run: python -m pytest -n 4
--timeout 180
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/hypothesis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Slow Hypothesis CI
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
types: [opened, reopened, synchronize, labeled]
workflow_dispatch: # allows you to trigger manually

jobs:
detect-ci-trigger:
name: detect ci trigger
runs-on: ubuntu-latest
if: |
github.repository == 'pydata/xarray'
&& (github.event_name == 'push' || github.event_name == 'pull_request')
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger@v1
id: detect-trigger
with:
keyword: "[skip-ci]"

hypothesis:
name: Slow Hypothesis Tests
runs-on: "ubuntu-latest"
needs: detect-ci-trigger
if: |
always()
&& (
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
|| needs.detect-ci-trigger.outputs.triggered == 'true'
|| contains( github.event.pull_request.labels.*.name, 'run-slow-hypothesis')
)
defaults:
run:
shell: bash -l {0}

env:
CONDA_ENV_FILE: ci/requirements/environment.yml
PYTHON_VERSION: "3.12"

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags.

- name: set environment variables
run: |
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/requirements/environment.yml
environment-name: xarray-tests
create-args: >-
python=${{env.PYTHON_VERSION}}
pytest-reportlog
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"

- name: Install xarray
run: |
python -m pip install --no-deps -e .
- name: Version info
run: |
conda info -a
conda list
python xarray/util/print_versions.py
- name: Restore cached hypothesis directory
uses: actions/cache@v4
with:
path: .hypothesis/
key: cache-hypothesis
enableCrossOsArchive: true
save-always: true
- name: Run slow Hypothesis tests
if: success()
id: status
run: |
python -m pytest --hypothesis-show-statistics --run-slow-hypothesis properties/*.py \
--report-log output-${{ matrix.python-version }}-log.jsonl
- name: Generate and publish the report
if: |
failure()
&& steps.status.outcome == 'failure'
&& github.event_name == 'schedule'
&& github.repository_owner == 'pydata'
uses: xarray-contrib/issue-from-pytest-log@v1
with:
log-path: output-${{ matrix.python-version }}-log.jsonl
issue-title: "Nightly Hypothesis tests failed"
issue-label: "topic-hypothesis"
21 changes: 21 additions & 0 deletions properties/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
import pytest


def pytest_addoption(parser):
parser.addoption(
"--run-slow-hypothesis",
action="store_true",
default=False,
help="run slow hypothesis tests",
)


def pytest_collection_modifyitems(config, items):
if config.getoption("--run-slow-hypothesis"):
return
skip_slow_hyp = pytest.mark.skip(reason="need --run-slow-hypothesis option to run")
for item in items:
if "slow_hypothesis" in item.keywords:
item.add_marker(skip_slow_hyp)


try:
from hypothesis import settings
except ImportError:
Expand Down
Loading
Loading