Skip to content

Commit d409eaf

Browse files
gfyoungjreback
authored andcommitted
MAINT: Remove pytest.warns in tests (#19341)
* MAINT: Check for pytest.warns in tests Per discussion in gh-18258, we are prohibiting its use in tests, at least for the time being. * MAINT: Patch lint error with pytest.warns The lint correctly fails on this line.
1 parent 2952fbd commit d409eaf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Diff for: ci/lint.sh

+8
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ if [ "$LINT" ]; then
8989
if [ $? = "0" ]; then
9090
RET=1
9191
fi
92+
93+
# Check for pytest.warns
94+
grep -r -E --include '*.py' 'pytest\.warns' pandas/tests/
95+
96+
if [ $? = "0" ]; then
97+
RET=1
98+
fi
99+
92100
echo "Check for invalid testing DONE"
93101

94102
# Check for imports from pandas.core.common instead

Diff for: pandas/tests/series/test_timeseries.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ def test_from_M8_structured(self):
937937
assert isinstance(s[0], Timestamp)
938938
assert s[0] == dates[0][0]
939939

940-
with pytest.warns(FutureWarning):
940+
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
941941
s = Series.from_array(arr['Date'], Index([0]))
942942
assert s[0] == dates[0][0]
943943

0 commit comments

Comments
 (0)