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

+6
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

+3
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

+4-1
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

+5
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

+3
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

+3
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

+2
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

+3
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

+3
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

+2
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

pandas/tests/frame/test_nonunique_indexes.py

+5
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, date_range
68
import pandas._testing as tm
@@ -14,6 +16,7 @@ def check(result, expected=None):
1416

1517

1618
class TestDataFrameNonuniqueIndexes:
19+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
1720
def test_column_dups_operations(self):
1821

1922
# assignment
@@ -310,6 +313,7 @@ def test_column_dups2(self):
310313
result = df.dropna(subset=["A", "C"], how="all")
311314
tm.assert_frame_equal(result, expected)
312315

316+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
313317
def test_getitem_boolean_series_with_duplicate_columns(self):
314318
# boolean indexing
315319
# GH 4879
@@ -337,6 +341,7 @@ def test_getitem_boolean_frame_with_duplicate_columns(self):
337341
result = df[df > 6]
338342
check(result, expected)
339343

344+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
340345
def test_getitem_boolean_frame_unaligned_with_duplicate_columns(self):
341346
# `df.A > 6` is a DataFrame with a different shape from df
342347
dups = ["A", "A", "C", "D"]

pandas/tests/groupby/test_function.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import numpy as np
55
import pytest
66

7+
from pandas.compat import is_numpy_dev
78
from pandas.errors import UnsupportedFunctionCall
89

910
import pandas as pd
@@ -1004,6 +1005,7 @@ def test_frame_describe_unstacked_format():
10041005
tm.assert_frame_equal(result, expected)
10051006

10061007

1008+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
10071009
@pytest.mark.filterwarnings(
10081010
"ignore:"
10091011
"indexing past lexsort depth may impact performance:"

pandas/tests/groupby/test_quantile.py

+7
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, Index
68
import pandas._testing as tm
@@ -71,6 +73,7 @@ def test_quantile_array():
7173
tm.assert_frame_equal(result, expected)
7274

7375

76+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
7477
def test_quantile_array2():
7578
# https://github.com/pandas-dev/pandas/pull/28085#issuecomment-524066959
7679
df = DataFrame(
@@ -106,6 +109,7 @@ def test_quantile_array_no_sort():
106109
tm.assert_frame_equal(result, expected)
107110

108111

112+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
109113
def test_quantile_array_multiple_levels():
110114
df = DataFrame(
111115
{"A": [0, 1, 2], "B": [3, 4, 5], "c": ["a", "a", "a"], "d": ["a", "a", "b"]}
@@ -216,6 +220,8 @@ def test_quantile_missing_group_values_correct_results(
216220
@pytest.mark.parametrize("q", [0.5, [0.0, 0.5, 1.0]])
217221
def test_groupby_quantile_nullable_array(values, q):
218222
# https://github.com/pandas-dev/pandas/issues/33136
223+
if isinstance(q, list):
224+
pytest.skip("GH#39089 Numpy changed dtype inference")
219225
df = DataFrame({"a": ["x"] * 3 + ["y"] * 3, "b": values})
220226
result = df.groupby("a")["b"].quantile(q)
221227

@@ -256,6 +262,7 @@ def test_groupby_timedelta_quantile():
256262
tm.assert_frame_equal(result, expected)
257263

258264

265+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
259266
def test_columns_groupby_quantile():
260267
# GH 33795
261268
df = DataFrame(

pandas/tests/indexes/base_class/test_indexing.py

+3
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
from pandas import Index
57
import pandas._testing as tm
68

@@ -13,6 +15,7 @@ def test_get_slice_bounds_within(self, kind, side, expected):
1315
result = index.get_slice_bound("e", kind=kind, side=side)
1416
assert result == expected
1517

18+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
1619
@pytest.mark.parametrize("kind", ["getitem", "loc", None])
1720
@pytest.mark.parametrize("side", ["left", "right"])
1821
@pytest.mark.parametrize(

pandas/tests/indexes/base_class/test_where.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import numpy as np
2+
import pytest
3+
4+
from pandas.compat import is_numpy_dev
25

36
from pandas import Index
47
import pandas._testing as tm
58

69

710
class TestWhere:
11+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
812
def test_where_intlike_str_doesnt_cast_ints(self):
913
idx = Index(range(3))
1014
mask = np.array([True, False, True])

pandas/tests/indexes/categorical/test_indexing.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22
import pytest
33

4+
from pandas.compat import is_numpy_dev
45
from pandas.errors import InvalidIndexError
56

67
import pandas as pd
@@ -129,6 +130,7 @@ def test_take_invalid_kwargs(self):
129130

130131

131132
class TestGetLoc:
133+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
132134
def test_get_loc(self):
133135
# GH 12531
134136
cidx1 = CategoricalIndex(list("abcde"), categories=list("edabc"))

pandas/tests/indexes/interval/test_interval.py

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import numpy as np
55
import pytest
66

7+
from pandas.compat import is_numpy_dev
78
from pandas.errors import InvalidIndexError
89

910
import pandas as pd
@@ -916,6 +917,9 @@ def test_searchsorted_different_argument_classes(klass):
916917
tm.assert_numpy_array_equal(result, expected)
917918

918919

920+
@pytest.mark.xfail(
921+
is_numpy_dev, reason="GH#39089 Numpy changed dtype inference", strict=False
922+
)
919923
@pytest.mark.parametrize(
920924
"arg", [[1, 2], ["a", "b"], [Timestamp("2020-01-01", tz="Europe/London")] * 2]
921925
)

pandas/tests/indexes/period/test_constructors.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pytest
33

44
from pandas._libs.tslibs.period import IncompatibleFrequency
5+
from pandas.compat import is_numpy_dev
56

67
from pandas.core.dtypes.dtypes import PeriodDtype
78

@@ -304,6 +305,7 @@ def test_constructor_incompat_freq(self):
304305
)
305306
)
306307

308+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
307309
def test_constructor_mixed(self):
308310
idx = PeriodIndex(["2011-01", NaT, Period("2011-01", freq="M")])
309311
exp = PeriodIndex(["2011-01", "NaT", "2011-01"], freq="M")

pandas/tests/indexes/test_base.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pytest
1010

1111
from pandas._libs.tslib import Timestamp
12-
from pandas.compat import IS64
12+
from pandas.compat import IS64, is_numpy_dev
1313
from pandas.compat.numpy import np_datetime64_compat
1414
from pandas.util._test_decorators import async_mark
1515

@@ -1358,6 +1358,7 @@ def test_slice_float_locs(self, dtype):
13581358
assert index2.slice_locs(8.5, 1.5) == (2, 6)
13591359
assert index2.slice_locs(10.5, -1) == (0, n)
13601360

1361+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
13611362
def test_slice_locs_dup(self):
13621363
index = Index(["a", "a", "b", "c", "d", "d"])
13631364
assert index.slice_locs("a", "d") == (0, 6)
@@ -1397,6 +1398,9 @@ def test_slice_locs_na_raises(self):
13971398
with pytest.raises(KeyError, match=""):
13981399
index.slice_locs(end=1.5)
13991400

1401+
@pytest.mark.xfail(
1402+
is_numpy_dev, reason="GH#39089 Numpy changed dtype inference", strict=False
1403+
)
14001404
@pytest.mark.parametrize(
14011405
"in_slice,expected",
14021406
[

pandas/tests/indexes/test_engines.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55

66
from pandas._libs import algos as libalgos, index as libindex
7+
from pandas.compat import is_numpy_dev
78

89
import pandas as pd
910
import pandas._testing as tm
@@ -198,6 +199,7 @@ def test_is_unique(self):
198199
engine = self.engine_type(lambda: arr, len(arr))
199200
assert engine.is_unique is False
200201

202+
@pytest.mark.xfail(is_numpy_dev, reason="GH#39089 Numpy changed dtype inference")
201203
def test_get_loc(self):
202204
# unique
203205
arr = np.array(self.values, dtype=self.dtype)

0 commit comments

Comments
 (0)