Skip to content

Commit 34cf06a

Browse files
mroeschkeyehoshuadimarsky
authored andcommitted
TST: Add @td.skip_if_no_scipy to failing test (pandas-dev#45731)
1 parent 4dfd2e2 commit 34cf06a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pandas/tests/series/methods/test_interpolate.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
isna,
1313
)
1414
import pandas._testing as tm
15+
from pandas.util.version import Version
1516

1617

1718
@pytest.fixture(
@@ -778,6 +779,7 @@ def test_interp_non_timedelta_index(self, interp_methods_ind, ind):
778779
with pytest.raises(ValueError, match=expected_error):
779780
df[0].interpolate(method=method, **kwargs)
780781

782+
@td.skip_if_no_scipy
781783
def test_interpolate_timedelta_index(self, request, interp_methods_ind):
782784
"""
783785
Tests for non numerical index types - object, period, timedelta
@@ -789,10 +791,11 @@ def test_interpolate_timedelta_index(self, request, interp_methods_ind):
789791
df = pd.DataFrame([0, 1, np.nan, 3], index=ind)
790792

791793
method, kwargs = interp_methods_ind
792-
if method == "pchip":
793-
pytest.importorskip("scipy")
794+
import scipy
794795

795-
if method in {"cubic", "zero"}:
796+
if method in {"cubic", "zero"} or (
797+
method == "barycentric" and Version(scipy.__version__) < Version("1.5.0")
798+
):
796799
request.node.add_marker(
797800
pytest.mark.xfail(
798801
reason=f"{method} interpolation is not supported for TimedeltaIndex"

0 commit comments

Comments
 (0)