Skip to content

Commit

Permalink
Backport PR #29057: CI: xfail on numpy 1.18 (#29059)
Browse files Browse the repository at this point in the history
  • Loading branch information
meeseeksmachine authored and TomAugspurger committed Oct 17, 2019
1 parent 148ddac commit 0a7e632
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 1 addition & 7 deletions ci/build38.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ pip install --no-deps -U pip wheel setuptools
pip install python-dateutil pytz cython pytest pytest-xdist hypothesis

# Possible alternative for getting numpy:
# pip install --pre -f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com/ numpy
git clone https://github.com/numpy/numpy
cd numpy
python setup.py build_ext --inplace
python setup.py install
cd ..
rm -rf numpy
pip install --pre -f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com/ numpy

python setup.py build_ext -inplace
python -m pip install --no-build-isolation -e .
Expand Down
1 change: 1 addition & 0 deletions pandas/compat/numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
_np_version_under1p15 = _nlv < LooseVersion("1.15")
_np_version_under1p16 = _nlv < LooseVersion("1.16")
_np_version_under1p17 = _nlv < LooseVersion("1.17")
_np_version_under1p18 = _nlv < LooseVersion("1.18")
_is_numpy_dev = ".dev" in str(_nlv)


Expand Down
13 changes: 13 additions & 0 deletions pandas/tests/series/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from numpy import nan
import pytest

from pandas.compat.numpy import _np_version_under1p18
import pandas.util._test_decorators as td

import pandas as pd
Expand Down Expand Up @@ -160,6 +161,9 @@ def test_cummax(self, datetime_series):

tm.assert_series_equal(result, expected)

@pytest.mark.xfail(
not _np_version_under1p18, reason="numpy 1.18 changed min/max behavior for NaT"
)
def test_cummin_datetime64(self):
s = pd.Series(
pd.to_datetime(["NaT", "2000-1-2", "NaT", "2000-1-1", "NaT", "2000-1-3"])
Expand All @@ -179,6 +183,9 @@ def test_cummin_datetime64(self):
result = s.cummin(skipna=False)
tm.assert_series_equal(expected, result)

@pytest.mark.xfail(
not _np_version_under1p18, reason="numpy 1.18 changed min/max behavior for NaT"
)
def test_cummax_datetime64(self):
s = pd.Series(
pd.to_datetime(["NaT", "2000-1-2", "NaT", "2000-1-1", "NaT", "2000-1-3"])
Expand All @@ -198,6 +205,9 @@ def test_cummax_datetime64(self):
result = s.cummax(skipna=False)
tm.assert_series_equal(expected, result)

@pytest.mark.xfail(
not _np_version_under1p18, reason="numpy 1.18 changed min/max behavior for NaT"
)
def test_cummin_timedelta64(self):
s = pd.Series(pd.to_timedelta(["NaT", "2 min", "NaT", "1 min", "NaT", "3 min"]))

Expand All @@ -213,6 +223,9 @@ def test_cummin_timedelta64(self):
result = s.cummin(skipna=False)
tm.assert_series_equal(expected, result)

@pytest.mark.xfail(
not _np_version_under1p18, reason="numpy 1.18 changed min/max behavior for NaT"
)
def test_cummax_timedelta64(self):
s = pd.Series(pd.to_timedelta(["NaT", "2 min", "NaT", "1 min", "NaT", "3 min"]))

Expand Down

0 comments on commit 0a7e632

Please sign in to comment.