Skip to content

Commit

Permalink
MAINT: Remove pytest.warns in tests (#19341)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
gfyoung authored and jreback committed Jan 22, 2018
1 parent 2952fbd commit d409eaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions ci/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ if [ "$LINT" ]; then
if [ $? = "0" ]; then
RET=1
fi

# Check for pytest.warns
grep -r -E --include '*.py' 'pytest\.warns' pandas/tests/

if [ $? = "0" ]; then
RET=1
fi

echo "Check for invalid testing DONE"

# Check for imports from pandas.core.common instead
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/series/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ def test_from_M8_structured(self):
assert isinstance(s[0], Timestamp)
assert s[0] == dates[0][0]

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

Expand Down

0 comments on commit d409eaf

Please sign in to comment.