diff --git a/pandas/tests/frame/test_rank.py b/pandas/tests/frame/test_rank.py index acf887d047c9e..78734f60e55b7 100644 --- a/pandas/tests/frame/test_rank.py +++ b/pandas/tests/frame/test_rank.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import pytest from datetime import timedelta, datetime from distutils.version import LooseVersion from numpy import nan @@ -195,6 +196,7 @@ def test_rank_axis(self): def test_rank_methods_frame(self): tm.skip_if_no_package('scipy', min_version='0.13', app='scipy.stats.rankdata') + pytest.importorskip('scipy.stats.special') import scipy from scipy.stats import rankdata diff --git a/pandas/tests/plotting/common.py b/pandas/tests/plotting/common.py index 3ab443b223f20..dfab539e9474c 100644 --- a/pandas/tests/plotting/common.py +++ b/pandas/tests/plotting/common.py @@ -39,7 +39,8 @@ def _ok_for_gaussian_kde(kind): from scipy.stats import gaussian_kde # noqa except ImportError: return False - return True + + return plotting._compat._mpl_ge_1_5_0() class TestPlotBase(object): diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py index e9c7d806fd65d..cff0c1c0b424e 100644 --- a/pandas/tests/plotting/test_datetimelike.py +++ b/pandas/tests/plotting/test_datetimelike.py @@ -610,6 +610,8 @@ def test_secondary_y_ts(self): @pytest.mark.slow def test_secondary_kde(self): + if not self.mpl_ge_1_5_0: + pytest.skip("mpl is not supported") tm._skip_if_no_scipy() _skip_if_no_scipy_gaussian_kde() diff --git a/pandas/tests/plotting/test_frame.py b/pandas/tests/plotting/test_frame.py index de470f1424b1b..67098529a0111 100644 --- a/pandas/tests/plotting/test_frame.py +++ b/pandas/tests/plotting/test_frame.py @@ -1289,6 +1289,9 @@ def test_boxplot_subplots_return_type(self): def test_kde_df(self): tm._skip_if_no_scipy() _skip_if_no_scipy_gaussian_kde() + if not self.mpl_ge_1_5_0: + pytest.skip("mpl is not supported") + df = DataFrame(randn(100, 4)) ax = _check_plot_works(df.plot, kind='kde') expected = [pprint_thing(c) for c in df.columns] @@ -1310,6 +1313,9 @@ def test_kde_df(self): def test_kde_missing_vals(self): tm._skip_if_no_scipy() _skip_if_no_scipy_gaussian_kde() + if not self.mpl_ge_1_5_0: + pytest.skip("mpl is not supported") + df = DataFrame(np.random.uniform(size=(100, 4))) df.loc[0, 0] = np.nan _check_plot_works(df.plot, kind='kde') @@ -1834,6 +1840,8 @@ def test_hist_colors(self): def test_kde_colors(self): tm._skip_if_no_scipy() _skip_if_no_scipy_gaussian_kde() + if not self.mpl_ge_1_5_0: + pytest.skip("mpl is not supported") from matplotlib import cm @@ -1857,6 +1865,8 @@ def test_kde_colors(self): def test_kde_colors_and_styles_subplots(self): tm._skip_if_no_scipy() _skip_if_no_scipy_gaussian_kde() + if not self.mpl_ge_1_5_0: + pytest.skip("mpl is not supported") from matplotlib import cm default_colors = self._maybe_unpack_cycler(self.plt.rcParams) diff --git a/pandas/tests/plotting/test_series.py b/pandas/tests/plotting/test_series.py index 9c9011ba1ca7b..8164ad74a190a 100644 --- a/pandas/tests/plotting/test_series.py +++ b/pandas/tests/plotting/test_series.py @@ -571,6 +571,9 @@ def test_plot_fails_with_dupe_color_and_style(self): @pytest.mark.slow def test_hist_kde(self): + if not self.mpl_ge_1_5_0: + pytest.skip("mpl is not supported") + _, ax = self.plt.subplots() ax = self.ts.plot.hist(logy=True, ax=ax) self._check_ax_scales(ax, yaxis='log') @@ -596,6 +599,9 @@ def test_hist_kde(self): def test_kde_kwargs(self): tm._skip_if_no_scipy() _skip_if_no_scipy_gaussian_kde() + if not self.mpl_ge_1_5_0: + pytest.skip("mpl is not supported") + from numpy import linspace _check_plot_works(self.ts.plot.kde, bw_method=.5, ind=linspace(-100, 100, 20)) @@ -611,6 +617,9 @@ def test_kde_kwargs(self): def test_kde_missing_vals(self): tm._skip_if_no_scipy() _skip_if_no_scipy_gaussian_kde() + if not self.mpl_ge_1_5_0: + pytest.skip("mpl is not supported") + s = Series(np.random.uniform(size=50)) s[0] = np.nan axes = _check_plot_works(s.plot.kde) @@ -638,6 +647,9 @@ def test_hist_kwargs(self): @pytest.mark.slow def test_hist_kde_color(self): + if not self.mpl_ge_1_5_0: + pytest.skip("mpl is not supported") + _, ax = self.plt.subplots() ax = self.ts.plot.hist(logy=True, bins=10, color='b', ax=ax) self._check_ax_scales(ax, yaxis='log') diff --git a/pandas/tests/series/test_rank.py b/pandas/tests/series/test_rank.py index ff489eb7f15b1..4dbc38fc9f4a6 100644 --- a/pandas/tests/series/test_rank.py +++ b/pandas/tests/series/test_rank.py @@ -29,6 +29,7 @@ class TestSeriesRank(TestData): def test_rank(self): tm._skip_if_no_scipy() + pytest.importorskip('scipy.stats.special') from scipy.stats import rankdata self.ts[::2] = np.nan @@ -248,6 +249,7 @@ def _check(s, expected, method='average'): def test_rank_methods_series(self): tm.skip_if_no_package('scipy', min_version='0.13', app='scipy.stats.rankdata') + pytest.importorskip('scipy.stats.special') import scipy from scipy.stats import rankdata diff --git a/pandas/tests/test_resample.py b/pandas/tests/test_resample.py index d938d5bf9f3ab..d42e37048d87f 100644 --- a/pandas/tests/test_resample.py +++ b/pandas/tests/test_resample.py @@ -1688,7 +1688,7 @@ def test_resample_dtype_preservation(self): def test_resample_dtype_coerceion(self): - pytest.importorskip('scipy') + pytest.importorskip('scipy.interpolate') # GH 16361 df = {"a": [1, 3, 1, 4]}