Skip to content

Commit 941ca21

Browse files
jbrockmendelsimonjayhawkins
authored andcommitted
Backport PR pandas-dev#41730: CI: suppress npdev warnings
1 parent e64410f commit 941ca21

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

pandas/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,17 @@
4141
from pandas.core import ops
4242
from pandas.core.indexes.api import Index, MultiIndex
4343

44+
# Until https://github.com/numpy/numpy/issues/19078 is sorted out, just suppress
45+
suppress_npdev_promotion_warning = pytest.mark.filterwarnings(
46+
"ignore:Promotion of numbers and bools:FutureWarning"
47+
)
4448

4549
# ----------------------------------------------------------------
4650
# Configuration / Settings
4751
# ----------------------------------------------------------------
4852
# pytest
53+
54+
4955
def pytest_configure(config):
5056
# Register marks to avoid warnings in pandas.test()
5157
# sync with setup.cfg
@@ -96,6 +102,11 @@ def pytest_runtest_setup(item):
96102
pytest.skip("skipping high memory test since --run-high-memory was not set")
97103

98104

105+
def pytest_collection_modifyitems(items):
106+
for item in items:
107+
item.add_marker(suppress_npdev_promotion_warning)
108+
109+
99110
# Hypothesis
100111
hypothesis.settings.register_profile(
101112
"ci",

pandas/tests/arithmetic/test_interval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def test_compare_list_like_nan(self, op, array, nulls_fixture, request):
235235
Categorical(list("abab")),
236236
Categorical(date_range("2017-01-01", periods=4)),
237237
pd.array(list("abcd")),
238-
pd.array(["foo", 3.14, None, object()]),
238+
pd.array(["foo", 3.14, None, object()], dtype=object),
239239
],
240240
ids=lambda x: str(x.dtype),
241241
)

pandas/tests/frame/methods/test_to_records.py

Lines changed: 12 additions & 2 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.numpy import is_numpy_dev
7+
68
from pandas import (
79
CategoricalDtype,
810
DataFrame,
@@ -162,20 +164,28 @@ def test_to_records_with_categorical(self):
162164
),
163165
),
164166
# Pass in a type instance.
165-
(
167+
pytest.param(
166168
{"column_dtypes": str},
167169
np.rec.array(
168170
[("0", "1", "0.2", "a"), ("1", "2", "1.5", "bc")],
169171
dtype=[("index", "<i8"), ("A", "<U"), ("B", "<U"), ("C", "<U")],
170172
),
173+
marks=pytest.mark.xfail(
174+
is_numpy_dev,
175+
reason="https://github.com/numpy/numpy/issues/19078",
176+
),
171177
),
172178
# Pass in a dtype instance.
173-
(
179+
pytest.param(
174180
{"column_dtypes": np.dtype("unicode")},
175181
np.rec.array(
176182
[("0", "1", "0.2", "a"), ("1", "2", "1.5", "bc")],
177183
dtype=[("index", "<i8"), ("A", "<U"), ("B", "<U"), ("C", "<U")],
178184
),
185+
marks=pytest.mark.xfail(
186+
is_numpy_dev,
187+
reason="https://github.com/numpy/numpy/issues/19078",
188+
),
179189
),
180190
# Pass in a dictionary (name-only).
181191
(

0 commit comments

Comments
 (0)