Skip to content

Commit 3b2ef43

Browse files
authored
Merge pull request #18 from data-apis/cron-job
CI updates
2 parents 8c1fc08 + 651f380 commit 3b2ef43

File tree

4 files changed

+57
-37
lines changed

4 files changed

+57
-37
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Run tests
2-
on: [push]
2+
on:
3+
push: null
4+
schedule:
5+
- cron: '0 0 * * 0' # i.e. every week
36
jobs:
47
test:
58
runs-on: ubuntu-latest
@@ -10,14 +13,17 @@ jobs:
1013
uses: actions/setup-python@v2
1114
with:
1215
python-version: 3.8
16+
- name: Upgrade pip
17+
run: |
18+
pip install pip --upgrade
1319
- name: Install dependencies
1420
run: |
1521
pip install -r requirements.txt
1622
- name: Install dataframe libraries
1723
run: |
1824
pip install ray git+https://github.com/modin-project/modin
1925
pip install vaex # use stable as no nightly builds and long build time
20-
pip install pandas --no-deps --ignore-installed # use stable as erroneous nightly builds and long build time
26+
pip install --pre --extra-index https://pypi.anaconda.org/scipy-wheels-nightly/simple pandas --ignore-installed --no-deps
2127
- name: Run tests
2228
run: |
2329
pytest tests/ -v --ci

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ repos:
99
hooks:
1010
- id: pyupgrade
1111
- repo: https://github.com/timothycrosley/isort
12-
rev: 5.9.2
12+
rev: 5.12.0
1313
hooks:
1414
- id: isort
1515
- repo: https://github.com/psf/black
1616
rev: 22.3.0
1717
hooks:
1818
- id: black
19-
- repo: https://gitlab.com/pycqa/flake8
19+
- repo: https://github.com/pycqa/flake8
2020
rev: 3.9.2
2121
hooks:
2222
- id: flake8

tests/conftest.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,16 @@ def pytest_configure(config):
3939

4040

4141
ci_xfail_ids = [
42-
# https://github.com/vaexio/vaex/pull/2150
43-
"tests/test_signatures.py::test_column_method[vaex-size]",
4442
# https://github.com/rapidsai/cudf/issues/11320
4543
"test_signatures.py::test_buffer_method[cudf-__dlpack__]",
4644
"test_signatures.py::test_buffer_method[cudf-__dlpack_device__]",
4745
# https://github.com/vaexio/vaex/issues/2083
4846
# https://github.com/vaexio/vaex/issues/2093
4947
# https://github.com/vaexio/vaex/issues/2113
50-
# https://github.com/vaexio/vaex/pull/2150
51-
"test_from_dataframe.py::test_from_dataframe_roundtrip[pandas-vaex]",
52-
"test_from_dataframe.py::test_from_dataframe_roundtrip[vaex-modin]",
5348
"test_from_dataframe.py::test_from_dataframe_roundtrip[modin-vaex]",
5449
"test_from_dataframe.py::test_from_dataframe_roundtrip[vaex-pandas]",
55-
# https://github.com/vaexio/vaex/pull/2150
56-
"test_column_object.py::test_size[vaex]",
5750
# https://github.com/rapidsai/cudf/issues/11389
5851
"test_column_object.py::test_dtype[cudf]",
59-
# https://github.com/vaexio/vaex/pull/2150
60-
"test_column_object.py::test_describe_categorical_on_categorical[vaex]",
6152
# Raises RuntimeError, which is technically correct, but the spec will
6253
# require TypeError soon.
6354
# See https://github.com/data-apis/dataframe-api/pull/74
@@ -75,6 +66,12 @@ def pytest_configure(config):
7566
# https://github.com/vaexio/vaex/issues/2118
7667
# https://github.com/vaexio/vaex/issues/2139
7768
"test_column_object.py::test_dtype[vaex]",
69+
# SEGFAULT
70+
"test_from_dataframe.py::test_from_dataframe_roundtrip[pandas-vaex]",
71+
# modin flakiness
72+
"test_from_dataframe.py::test_from_dataframe_roundtrip[modin-pandas]",
73+
"test_from_dataframe.py::test_from_dataframe_roundtrip[modin-modin]",
74+
"test_meta.py::test_frame_equal[modin]",
7875
]
7976
assert not any(case in ci_xfail_ids for case in ci_skip_ids) # sanity check
8077

tests/wrappers.py

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import re
22
from copy import copy
33
from typing import Any, Callable, Dict, List, NamedTuple, Set, Tuple
4+
from unittest.mock import MagicMock
45

56
import numpy as np
67
import pytest
@@ -79,7 +80,8 @@ def __repr__(self) -> str:
7980
return f"LibraryInfo(<{self.name}>)"
8081

8182

82-
libinfo_params = []
83+
unskipped_params = []
84+
skipped_params = []
8385

8486

8587
# pandas
@@ -89,7 +91,9 @@ def __repr__(self) -> str:
8991
import pandas as pd
9092
from pandas.api.interchange import from_dataframe as pandas_from_dataframe
9193
except ImportError as e:
92-
libinfo_params.append(pytest.param("pandas", marks=pytest.mark.skip(reason=e.msg)))
94+
skipped_params.append(
95+
pytest.param(None, id="pandas", marks=pytest.mark.skip(reason=e.msg))
96+
)
9397
else:
9498

9599
def pandas_mock_to_toplevel(mock_df: MockDataFrame) -> pd.DataFrame:
@@ -112,7 +116,7 @@ def pandas_mock_to_toplevel(mock_df: MockDataFrame) -> pd.DataFrame:
112116
from_dataframe=pandas_from_dataframe,
113117
frame_equal=lambda df1, df2: df1.equals(df2),
114118
)
115-
libinfo_params.append(pytest.param(pandas_libinfo, id=pandas_libinfo.name))
119+
unskipped_params.append(pytest.param(pandas_libinfo, id=pandas_libinfo.name))
116120

117121

118122
# vaex
@@ -122,7 +126,9 @@ def pandas_mock_to_toplevel(mock_df: MockDataFrame) -> pd.DataFrame:
122126
import vaex
123127
from vaex.dataframe_protocol import from_dataframe_to_vaex as vaex_from_dataframe
124128
except ImportError as e:
125-
libinfo_params.append(pytest.param("vaex", marks=pytest.mark.skip(reason=e.msg)))
129+
skipped_params.append(
130+
pytest.param(None, id="modin", marks=pytest.mark.skip(reason=e.msg))
131+
)
126132
else:
127133

128134
def vaex_mock_to_toplevel(mock_df: MockDataFrame) -> TopLevelDataFrame:
@@ -172,30 +178,24 @@ def vaex_frame_equal(df1, df2) -> bool:
172178
allow_zero_cols=False,
173179
allow_zero_rows=False,
174180
)
175-
libinfo_params.append(pytest.param(vaex_libinfo, id=vaex_libinfo.name))
181+
unskipped_params.append(pytest.param(vaex_libinfo, id=vaex_libinfo.name))
176182

177183

178184
# modin
179185
# -----
180186

181187

182188
try:
183-
import modin # noqa: F401
189+
# ethereal hacks! ----------------------------------------------------------
190+
import pandas
184191

185-
try:
186-
import pandas
187-
from pandas.core import base
188-
from pandas.errors import DataError
189-
except ImportError:
190-
pass
191-
else:
192-
# One issue modin has with pandas upstream is an outdated import of an
193-
# exception class, so we try monkey-patching the class to the old path.
194-
setattr(base, "DataError", DataError)
195-
# modin also hard checks for supported pandas versions, so we
196-
# monkey-patch a supported version.
197-
setattr(pandas, "__version__", "1.4.3")
192+
setattr(pandas, "__getattr__", MagicMock())
193+
if not hasattr(pandas.DataFrame, "mad"):
194+
setattr(pandas.DataFrame, "mad", MagicMock())
195+
setattr(pandas.core.indexing, "__getattr__", MagicMock())
196+
# ------------------------------------------------------------ end of hacks.
198197

198+
import modin # noqa: F401
199199
import ray
200200

201201
# Without local_mode=True, ray does not use our monkey-patched pandas
@@ -208,7 +208,9 @@ def vaex_frame_equal(df1, df2) -> bool:
208208
from modin import pandas as mpd
209209
from modin.pandas.utils import from_dataframe as modin_from_dataframe
210210
except ImportError as e:
211-
libinfo_params.append(pytest.param("modin", marks=pytest.mark.skip(reason=e.msg)))
211+
skipped_params.append(
212+
pytest.param(None, id="modin", marks=pytest.mark.skip(reason=e.msg))
213+
)
212214
else:
213215

214216
def modin_mock_to_toplevel(mock_df: MockDataFrame) -> mpd.DataFrame:
@@ -259,15 +261,15 @@ def modin_frame_equal(df1: mpd.DataFrame, df2: mpd.DataFrame) -> bool:
259261
# https://github.com/modin-project/modin/issues/4643
260262
allow_zero_rows=False,
261263
)
262-
libinfo_params.append(pytest.param(modin_libinfo, id=modin_libinfo.name))
264+
unskipped_params.append(pytest.param(modin_libinfo, id=modin_libinfo.name))
263265

264266

265267
# cuDF
266268
# -----
267269

268270

269271
try:
270-
# cudf has a few issues with upstream pandas that we "fix" with a few hacks
272+
# ethereal hacks! ----------------------------------------------------------
271273
try:
272274
import pandas
273275
import pyarrow
@@ -294,11 +296,14 @@ def register_extension_type(*a, **kw):
294296
setattr(pyarrow, "register_extension_type", register_extension_type)
295297
setattr(datetimes, "_guess_datetime_format", guess_datetime_format)
296298
setattr(pandas, "__version__", "1.4.3")
299+
# ------------------------------------------------------------ end of hacks.
297300

298301
import cudf
299302
from cudf.core.df_protocol import from_dataframe as cudf_from_dataframe
300303
except ImportError as e:
301-
libinfo_params.append(pytest.param("cudf", marks=pytest.mark.skip(reason=e.msg)))
304+
skipped_params.append(
305+
pytest.param(None, id="cudf", marks=pytest.mark.skip(reason=e.msg))
306+
)
302307
else:
303308

304309
def cudf_mock_to_toplevel(mock_df: MockDataFrame) -> cudf.DataFrame:
@@ -332,12 +337,24 @@ def cudf_mock_to_toplevel(mock_df: MockDataFrame) -> cudf.DataFrame:
332337
NominalDtype.UTF8,
333338
},
334339
)
335-
libinfo_params.append(pytest.param(cudf_libinfo, id=cudf_libinfo.name))
340+
unskipped_params.append(pytest.param(cudf_libinfo, id=cudf_libinfo.name))
336341

342+
libinfo_params = skipped_params + unskipped_params
343+
ids = [p.id for p in libinfo_params]
344+
assert len(set(ids)) == len(ids), f"ids: {ids}" # sanity check
337345

338346
libname_to_libinfo: Dict[str, LibraryInfo] = {}
339347
for param in libinfo_params:
340348
if not any(m.name.startswith("skip") for m in param.marks):
341349
libinfo = param.values[0]
342350
assert isinstance(libinfo, LibraryInfo) # for mypy
343351
libname_to_libinfo[libinfo.name] = libinfo
352+
353+
354+
if __name__ == "__main__":
355+
print(f"Wrapped libraries: {[p.id for p in unskipped_params]}")
356+
if len(skipped_params) > 0:
357+
print("Skipped libraries:")
358+
for p in skipped_params:
359+
m = next(m for m in p.marks if m.name == "skip")
360+
print(f" {p.id}; reason={m.kwargs['reason']}")

0 commit comments

Comments
 (0)