Skip to content

Commit 3bd3d1e

Browse files
authored
CI: Skip numpy dev failing tests (#39090)
* CI: Skip numpy dev failing tests * Xfail missed test * Pull is_numpy_dev up
1 parent 53810fd commit 3bd3d1e

31 files changed

+107
-5
lines changed

pandas/compat/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import warnings
1313

1414
from pandas._typing import F
15+
from pandas.compat.numpy import is_numpy_dev
1516

1617
PY38 = sys.version_info >= (3, 8)
1718
PY39 = sys.version_info >= (3, 9)
@@ -118,3 +119,8 @@ def get_lzma_file(lzma):
118119
"might be required to solve this issue."
119120
)
120121
return lzma.LZMAFile
122+
123+
124+
__all__ = [
125+
"is_numpy_dev",
126+
]

pandas/tests/arithmetic/test_interval.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import numpy as np
44
import pytest
55

6+
from pandas.compat import is_numpy_dev
7+
68
from pandas.core.dtypes.common import is_list_like
79

810
import pandas as pd
@@ -252,6 +254,7 @@ def test_compare_length_mismatch_errors(self, op, other_constructor, length):
252254
with pytest.raises(ValueError, match="Lengths must match to compare"):
253255
op(array, other)
254256

257+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
255258
@pytest.mark.parametrize(
256259
"constructor, expected_type, assert_func",
257260
[

pandas/tests/base/test_misc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44
import pytest
55

6-
from pandas.compat import IS64, PYPY
6+
from pandas.compat import IS64, PYPY, is_numpy_dev
77

88
from pandas.core.dtypes.common import is_categorical_dtype, is_object_dtype
99

@@ -116,6 +116,9 @@ def test_searchsorted(index_or_series_obj):
116116
# See gh-14833
117117
pytest.skip("np.searchsorted doesn't work on pd.MultiIndex")
118118

119+
if is_object_dtype(obj) and is_numpy_dev:
120+
pytest.skip("GH#39089 Numpy changed dtype inference")
121+
119122
max_obj = max(obj, default=0)
120123
index = np.searchsorted(obj, max_obj)
121124
assert 0 <= index <= len(obj)

pandas/tests/extension/base/methods.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import numpy as np
44
import pytest
55

6+
from pandas.compat import is_numpy_dev
7+
68
from pandas.core.dtypes.common import is_bool_dtype
79

810
import pandas as pd
@@ -392,6 +394,9 @@ def test_hash_pandas_object_works(self, data, as_frame):
392394
b = pd.util.hash_pandas_object(data)
393395
self.assert_equal(a, b)
394396

397+
@pytest.mark.xfail(
398+
is_numpy_dev, reason="GH#39089 Numpy changed dtype inference", strict=False
399+
)
395400
def test_searchsorted(self, data_for_sorting, as_series):
396401
b, c, a = data_for_sorting
397402
arr = type(data_for_sorting)._from_sequence([a, b, c])

pandas/tests/frame/apply/test_frame_apply.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import numpy as np
66
import pytest
77

8+
from pandas.compat import is_numpy_dev
9+
810
from pandas.core.dtypes.dtypes import CategoricalDtype
911

1012
import pandas as pd
@@ -582,6 +584,7 @@ def test_apply_dict(self):
582584
tm.assert_frame_equal(reduce_false, df)
583585
tm.assert_series_equal(reduce_none, dicts)
584586

587+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
585588
def test_applymap(self, float_frame):
586589
applied = float_frame.applymap(lambda x: x * 2)
587590
tm.assert_frame_equal(applied, float_frame * 2)

pandas/tests/frame/indexing/test_indexing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pytest
66

77
from pandas._libs import iNaT
8+
from pandas.compat import is_numpy_dev
89

910
from pandas.core.dtypes.common import is_integer
1011

@@ -254,6 +255,8 @@ def inc(x):
254255
)
255256
def test_setitem_same_column(self, cols, values, expected):
256257
# GH 23239
258+
if cols == ["C", "D", "D", "a"] and is_numpy_dev:
259+
pytest.skip("GH#39089 Numpy changed dtype inference")
257260
df = DataFrame([values], columns=cols)
258261
df["a"] = df["a"]
259262
result = df["a"].values[0]

pandas/tests/frame/methods/test_drop.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import numpy as np
44
import pytest
55

6+
from pandas.compat import is_numpy_dev
67
from pandas.errors import PerformanceWarning
78

89
import pandas as pd
@@ -107,6 +108,7 @@ def test_drop_names(self):
107108
expected = Index(["a", "b", "c"], name="first")
108109
tm.assert_index_equal(dropped.index, expected)
109110

111+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
110112
def test_drop(self):
111113
simple = DataFrame({"A": [1, 2, 3, 4], "B": [0, 1, 2, 3]})
112114
tm.assert_frame_equal(simple.drop("A", axis=1), simple[["B"]])

pandas/tests/frame/methods/test_isin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
22
import pytest
33

4+
from pandas.compat import is_numpy_dev
5+
46
import pandas as pd
57
from pandas import DataFrame, MultiIndex, Series
68
import pandas._testing as tm
@@ -32,6 +34,7 @@ def test_isin_empty(self, empty):
3234
result = df.isin(empty)
3335
tm.assert_frame_equal(result, expected)
3436

37+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
3538
def test_isin_dict(self):
3639
df = DataFrame({"A": ["a", "b", "c"], "B": ["a", "e", "f"]})
3740
d = {"A": ["a"]}

pandas/tests/frame/methods/test_replace.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import numpy as np
77
import pytest
88

9+
from pandas.compat import is_numpy_dev
10+
911
import pandas as pd
1012
from pandas import DataFrame, Index, Series, Timestamp, date_range
1113
import pandas._testing as tm
@@ -1508,6 +1510,7 @@ def test_replace_no_replacement_dtypes(self, dtype, value):
15081510
result = df.replace(to_replace=[None, -np.inf, np.inf], value=value)
15091511
tm.assert_frame_equal(result, df)
15101512

1513+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
15111514
@pytest.mark.parametrize("replacement", [np.nan, 5])
15121515
def test_replace_with_duplicate_columns(self, replacement):
15131516
# GH 24798

pandas/tests/frame/methods/test_to_csv.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import numpy as np
66
import pytest
77

8+
from pandas.compat import is_numpy_dev
89
from pandas.errors import ParserError
910

1011
import pandas as pd
@@ -181,6 +182,7 @@ def test_to_csv_cols_reordering(self):
181182

182183
tm.assert_frame_equal(df[cols], rs_c, check_names=False)
183184

185+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
184186
def test_to_csv_new_dupe_cols(self):
185187
import pandas as pd
186188

0 commit comments

Comments
 (0)