Skip to content

Commit

Permalink
CI: Enable pytables and numba in 312 build (#57998)
Browse files Browse the repository at this point in the history
* CI: Enable pytables and numba in 312 build

* Add xfails

* TypeError
  • Loading branch information
mroeschke authored Mar 26, 2024
1 parent 8928948 commit 5703f11
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ci/deps/actions-312.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
- jinja2>=3.1.2
- lxml>=4.9.2
- matplotlib>=3.6.3
# - numba>=0.56.4
- numba>=0.56.4
- numexpr>=2.8.4
- odfpy>=1.4.1
- qtpy>=2.3.0
Expand All @@ -44,7 +44,7 @@ dependencies:
- pyarrow>=10.0.1
- pymysql>=1.0.2
- pyreadstat>=1.2.0
# - pytables>=3.8.0
- pytables>=3.8.0
- python-calamine>=0.1.7
- pyxlsb>=1.0.10
- s3fs>=2022.11.0
Expand Down
10 changes: 9 additions & 1 deletion pandas/tests/io/pytables/test_append.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest

from pandas._libs.tslibs import Timestamp
from pandas.compat import PY312

import pandas as pd
from pandas import (
Expand Down Expand Up @@ -283,7 +284,7 @@ def test_append_all_nans(setup_path):
tm.assert_frame_equal(store["df2"], df, check_index_type=True)


def test_append_frame_column_oriented(setup_path):
def test_append_frame_column_oriented(setup_path, request):
with ensure_clean_store(setup_path) as store:
# column oriented
df = DataFrame(
Expand All @@ -303,6 +304,13 @@ def test_append_frame_column_oriented(setup_path):
tm.assert_frame_equal(expected, result)

# selection on the non-indexable
request.applymarker(
pytest.mark.xfail(
PY312,
reason="AST change in PY312",
raises=ValueError,
)
)
result = store.select("df1", ("columns=A", "index=df.index[0:4]"))
expected = df.reindex(columns=["A"], index=df.index[0:4])
tm.assert_frame_equal(expected, result)
Expand Down
19 changes: 17 additions & 2 deletions pandas/tests/io/pytables/test_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest

from pandas._libs.tslibs import Timestamp
from pandas.compat import PY312

import pandas as pd
from pandas import (
Expand Down Expand Up @@ -168,7 +169,7 @@ def test_select(setup_path):
tm.assert_frame_equal(expected, result)


def test_select_dtypes(setup_path):
def test_select_dtypes(setup_path, request):
with ensure_clean_store(setup_path) as store:
# with a Timestamp data column (GH #2637)
df = DataFrame(
Expand Down Expand Up @@ -279,6 +280,13 @@ def test_select_dtypes(setup_path):
expected = df[df["A"] > 0]

store.append("df", df, data_columns=True)
request.applymarker(
pytest.mark.xfail(
PY312,
reason="AST change in PY312",
raises=ValueError,
)
)
np_zero = np.float64(0) # noqa: F841
result = store.select("df", where=["A>np_zero"])
tm.assert_frame_equal(expected, result)
Expand Down Expand Up @@ -607,7 +615,7 @@ def test_select_iterator_many_empty_frames(setup_path):
assert len(results) == 0


def test_frame_select(setup_path):
def test_frame_select(setup_path, request):
df = DataFrame(
np.random.default_rng(2).standard_normal((10, 4)),
columns=Index(list("ABCD"), dtype=object),
Expand All @@ -624,6 +632,13 @@ def test_frame_select(setup_path):
crit2 = "columns=['A', 'D']"
crit3 = "columns=A"

request.applymarker(
pytest.mark.xfail(
PY312,
reason="AST change in PY312",
raises=TypeError,
)
)
result = store.select("frame", [crit1, crit2])
expected = df.loc[date:, ["A", "D"]]
tm.assert_frame_equal(result, expected)
Expand Down
11 changes: 10 additions & 1 deletion pandas/tests/io/pytables/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import numpy as np
import pytest

from pandas.compat import PY312

import pandas as pd
from pandas import (
DataFrame,
Expand Down Expand Up @@ -866,14 +868,21 @@ def test_start_stop_fixed(setup_path):
df.iloc[8:10, -2] = np.nan


def test_select_filter_corner(setup_path):
def test_select_filter_corner(setup_path, request):
df = DataFrame(np.random.default_rng(2).standard_normal((50, 100)))
df.index = [f"{c:3d}" for c in df.index]
df.columns = [f"{c:3d}" for c in df.columns]

with ensure_clean_store(setup_path) as store:
store.put("frame", df, format="table")

request.applymarker(
pytest.mark.xfail(
PY312,
reason="AST change in PY312",
raises=ValueError,
)
)
crit = "columns=df.columns[:75]"
result = store.select("frame", [crit])
tm.assert_frame_equal(result, df.loc[:, df.columns[:75]])
Expand Down

0 comments on commit 5703f11

Please sign in to comment.