Skip to content

Commit da5f914

Browse files
authored
TST: mark all plotting tests as slow (#38079)
1 parent 25846e9 commit da5f914

14 files changed

+31
-202
lines changed

pandas/tests/plotting/frame/test_frame.py

+2-45
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
from pandas.io.formats.printing import pprint_thing
2222
import pandas.plotting as plotting
2323

24+
pytestmark = pytest.mark.slow
25+
2426

2527
@td.skip_if_no_mpl
2628
class TestDataFramePlots(TestPlotBase):
@@ -39,7 +41,6 @@ def setup_method(self, method):
3941
}
4042
)
4143

42-
@pytest.mark.slow
4344
def test_plot(self):
4445
from pandas.plotting._matplotlib.compat import mpl_ge_3_1_0
4546

@@ -171,21 +172,18 @@ def test_nonnumeric_exclude(self):
171172
ax = df.plot()
172173
assert len(ax.get_lines()) == 1 # B was plotted
173174

174-
@pytest.mark.slow
175175
def test_implicit_label(self):
176176
df = DataFrame(np.random.randn(10, 3), columns=["a", "b", "c"])
177177
ax = df.plot(x="a", y="b")
178178
self._check_text_labels(ax.xaxis.get_label(), "a")
179179

180-
@pytest.mark.slow
181180
def test_donot_overwrite_index_name(self):
182181
# GH 8494
183182
df = DataFrame(np.random.randn(2, 2), columns=["a", "b"])
184183
df.index.name = "NAME"
185184
df.plot(y="b", label="LABEL")
186185
assert df.index.name == "NAME"
187186

188-
@pytest.mark.slow
189187
def test_plot_xy(self):
190188
# columns.inferred_type == 'string'
191189
df = self.tdf
@@ -210,7 +208,6 @@ def test_plot_xy(self):
210208
# columns.inferred_type == 'mixed'
211209
# TODO add MultiIndex test
212210

213-
@pytest.mark.slow
214211
@pytest.mark.parametrize(
215212
"input_log, expected_log", [(True, "log"), ("sym", "symlog")]
216213
)
@@ -239,7 +236,6 @@ def test_invalid_logscale(self, input_param):
239236
with pytest.raises(ValueError, match=msg):
240237
df.plot(**{input_param: "sm"})
241238

242-
@pytest.mark.slow
243239
def test_xcompat(self):
244240
import pandas as pd
245241

@@ -488,7 +484,6 @@ def test_area_sharey_dont_overwrite(self):
488484
assert ax1._shared_y_axes.joined(ax1, ax2)
489485
assert ax2._shared_y_axes.joined(ax1, ax2)
490486

491-
@pytest.mark.slow
492487
def test_bar_linewidth(self):
493488
df = DataFrame(np.random.randn(5, 5))
494489

@@ -509,7 +504,6 @@ def test_bar_linewidth(self):
509504
for r in ax.patches:
510505
assert r.get_linewidth() == 2
511506

512-
@pytest.mark.slow
513507
def test_bar_barwidth(self):
514508
df = DataFrame(np.random.randn(5, 5))
515509

@@ -547,7 +541,6 @@ def test_bar_barwidth(self):
547541
for r in ax.patches:
548542
assert r.get_height() == width
549543

550-
@pytest.mark.slow
551544
def test_bar_bottom_left(self):
552545
df = DataFrame(np.random.rand(5, 5))
553546
ax = df.plot.bar(stacked=False, bottom=1)
@@ -576,7 +569,6 @@ def test_bar_bottom_left(self):
576569
result = [p.get_x() for p in ax.patches]
577570
assert result == [1] * 5
578571

579-
@pytest.mark.slow
580572
def test_bar_nan(self):
581573
df = DataFrame({"A": [10, np.nan, 20], "B": [5, 10, 20], "C": [1, 2, 3]})
582574
ax = df.plot.bar()
@@ -592,7 +584,6 @@ def test_bar_nan(self):
592584
expected = [0.0, 0.0, 0.0, 10.0, 0.0, 20.0, 15.0, 10.0, 40.0]
593585
assert result == expected
594586

595-
@pytest.mark.slow
596587
def test_bar_categorical(self):
597588
# GH 13019
598589
df1 = DataFrame(
@@ -622,7 +613,6 @@ def test_bar_categorical(self):
622613
assert ax.patches[0].get_x() == -0.25
623614
assert ax.patches[-1].get_x() == 4.75
624615

625-
@pytest.mark.slow
626616
def test_plot_scatter(self):
627617
df = DataFrame(
628618
np.random.randn(6, 4),
@@ -673,14 +663,12 @@ def test_scatterplot_object_data(self):
673663
_check_plot_works(df.plot.scatter, x=0, y=1)
674664

675665
@pytest.mark.parametrize("x, y", [("x", "y"), ("y", "x"), ("y", "y")])
676-
@pytest.mark.slow
677666
def test_plot_scatter_with_categorical_data(self, x, y):
678667
# after fixing GH 18755, should be able to plot categorical data
679668
df = DataFrame({"x": [1, 2, 3, 4], "y": pd.Categorical(["a", "b", "a", "c"])})
680669

681670
_check_plot_works(df.plot.scatter, x=x, y=y)
682671

683-
@pytest.mark.slow
684672
def test_plot_scatter_with_c(self):
685673
df = DataFrame(
686674
np.random.randn(6, 4),
@@ -739,7 +727,6 @@ def test_plot_scatter_with_s(self):
739727
ax = df.plot.scatter(x="a", y="b", s="c")
740728
tm.assert_numpy_array_equal(df["c"].values, right=ax.collections[0].get_sizes())
741729

742-
@pytest.mark.slow
743730
def test_plot_bar(self):
744731
df = DataFrame(
745732
np.random.randn(6, 4),
@@ -772,7 +759,6 @@ def test_plot_bar(self):
772759
ax = df.plot.barh(rot=55, fontsize=11)
773760
self._check_ticks_props(ax, yrot=55, ylabelsize=11, xlabelsize=11)
774761

775-
@pytest.mark.slow
776762
def test_boxplot(self):
777763
df = self.hist_df
778764
series = df["height"]
@@ -801,7 +787,6 @@ def test_boxplot(self):
801787
tm.assert_numpy_array_equal(ax.xaxis.get_ticklocs(), positions)
802788
assert len(ax.lines) == self.bp_n_objects * len(numeric_cols)
803789

804-
@pytest.mark.slow
805790
def test_boxplot_vertical(self):
806791
df = self.hist_df
807792
numeric_cols = df._get_numeric_data().columns
@@ -832,7 +817,6 @@ def test_boxplot_vertical(self):
832817
tm.assert_numpy_array_equal(ax.yaxis.get_ticklocs(), positions)
833818
assert len(ax.lines) == self.bp_n_objects * len(numeric_cols)
834819

835-
@pytest.mark.slow
836820
def test_boxplot_return_type(self):
837821
df = DataFrame(
838822
np.random.randn(6, 4),
@@ -854,7 +838,6 @@ def test_boxplot_return_type(self):
854838
result = df.plot.box(return_type="both")
855839
self._check_box_return_type(result, "both")
856840

857-
@pytest.mark.slow
858841
@td.skip_if_no_scipy
859842
def test_kde_df(self):
860843
df = DataFrame(np.random.randn(100, 4))
@@ -877,14 +860,12 @@ def test_kde_df(self):
877860
axes = df.plot(kind="kde", logy=True, subplots=True)
878861
self._check_ax_scales(axes, yaxis="log")
879862

880-
@pytest.mark.slow
881863
@td.skip_if_no_scipy
882864
def test_kde_missing_vals(self):
883865
df = DataFrame(np.random.uniform(size=(100, 4)))
884866
df.loc[0, 0] = np.nan
885867
_check_plot_works(df.plot, kind="kde")
886868

887-
@pytest.mark.slow
888869
def test_hist_df(self):
889870
from matplotlib.patches import Rectangle
890871

@@ -966,7 +947,6 @@ def _check_box_coord(
966947
if expected_w is not None:
967948
tm.assert_numpy_array_equal(result_width, expected_w, check_dtype=False)
968949

969-
@pytest.mark.slow
970950
def test_hist_df_coord(self):
971951
normal_df = DataFrame(
972952
{
@@ -1098,12 +1078,10 @@ def test_hist_df_coord(self):
10981078
expected_w=np.array([6, 7, 8, 9, 10]),
10991079
)
11001080

1101-
@pytest.mark.slow
11021081
def test_plot_int_columns(self):
11031082
df = DataFrame(np.random.randn(100, 4)).cumsum()
11041083
_check_plot_works(df.plot, legend=True)
11051084

1106-
@pytest.mark.slow
11071085
def test_df_legend_labels(self):
11081086
kinds = ["line", "bar", "barh", "kde", "area", "hist"]
11091087
df = DataFrame(np.random.rand(3, 3), columns=["a", "b", "c"])
@@ -1217,7 +1195,6 @@ def test_legend_name(self):
12171195
leg_title = ax.legend_.get_title()
12181196
self._check_text_labels(leg_title, "new")
12191197

1220-
@pytest.mark.slow
12211198
def test_no_legend(self):
12221199
kinds = ["line", "bar", "barh", "kde", "area", "hist"]
12231200
df = DataFrame(np.random.rand(3, 3), columns=["a", "b", "c"])
@@ -1226,7 +1203,6 @@ def test_no_legend(self):
12261203
ax = df.plot(kind=kind, legend=False)
12271204
self._check_legend_labels(ax, visible=False)
12281205

1229-
@pytest.mark.slow
12301206
def test_style_by_column(self):
12311207
import matplotlib.pyplot as plt
12321208

@@ -1245,7 +1221,6 @@ def test_style_by_column(self):
12451221
for idx, line in enumerate(ax.get_lines()[: len(markers)]):
12461222
assert line.get_marker() == markers[idx]
12471223

1248-
@pytest.mark.slow
12491224
def test_line_label_none(self):
12501225
s = Series([1, 2])
12511226
ax = s.plot()
@@ -1302,7 +1277,6 @@ def test_all_invalid_plot_data(self):
13021277
with pytest.raises(TypeError, match=msg):
13031278
df.plot(kind=kind)
13041279

1305-
@pytest.mark.slow
13061280
def test_partially_invalid_plot_data(self):
13071281
with tm.RNGContext(42):
13081282
df = DataFrame(np.random.randn(10, 2), dtype=object)
@@ -1372,7 +1346,6 @@ def test_xy_args_integer(self, x, y, colnames):
13721346
df.columns = colnames
13731347
_check_plot_works(df.plot, x=x, y=y)
13741348

1375-
@pytest.mark.slow
13761349
def test_hexbin_basic(self):
13771350
df = self.hexbin_df
13781351

@@ -1388,7 +1361,6 @@ def test_hexbin_basic(self):
13881361
# return value is single axes
13891362
self._check_axes_shape(axes, axes_num=1, layout=(1, 1))
13901363

1391-
@pytest.mark.slow
13921364
def test_hexbin_with_c(self):
13931365
df = self.hexbin_df
13941366

@@ -1398,7 +1370,6 @@ def test_hexbin_with_c(self):
13981370
ax = df.plot.hexbin(x="A", y="B", C="C", reduce_C_function=np.std)
13991371
assert len(ax.collections) == 1
14001372

1401-
@pytest.mark.slow
14021373
@pytest.mark.parametrize(
14031374
"kwargs, expected",
14041375
[
@@ -1412,7 +1383,6 @@ def test_hexbin_cmap(self, kwargs, expected):
14121383
ax = df.plot.hexbin(x="A", y="B", **kwargs)
14131384
assert ax.collections[0].cmap.name == expected
14141385

1415-
@pytest.mark.slow
14161386
def test_pie_df(self):
14171387
df = DataFrame(
14181388
np.random.rand(5, 3),
@@ -1484,7 +1454,6 @@ def test_pie_df_nan(self):
14841454
expected_labels = base_expected[:i] + base_expected[i + 1 :]
14851455
assert result_labels == expected_labels
14861456

1487-
@pytest.mark.slow
14881457
def test_errorbar_plot(self):
14891458
d = {"x": np.arange(12), "y": np.arange(12, 0, -1)}
14901459
df = DataFrame(d)
@@ -1531,7 +1500,6 @@ def test_errorbar_plot(self):
15311500
with pytest.raises((ValueError, TypeError)):
15321501
df.plot(yerr=df_err)
15331502

1534-
@pytest.mark.slow
15351503
@pytest.mark.parametrize("kind", ["line", "bar", "barh"])
15361504
def test_errorbar_plot_different_kinds(self, kind):
15371505
d = {"x": np.arange(12), "y": np.arange(12, 0, -1)}
@@ -1565,7 +1533,6 @@ def test_errorbar_plot_different_kinds(self, kind):
15651533
self._check_has_errorbars(axes, xerr=1, yerr=1)
15661534

15671535
@pytest.mark.xfail(reason="Iterator is consumed", raises=ValueError)
1568-
@pytest.mark.slow
15691536
def test_errorbar_plot_iterator(self):
15701537
with warnings.catch_warnings():
15711538
d = {"x": np.arange(12), "y": np.arange(12, 0, -1)}
@@ -1575,7 +1542,6 @@ def test_errorbar_plot_iterator(self):
15751542
ax = _check_plot_works(df.plot, yerr=itertools.repeat(0.1, len(df)))
15761543
self._check_has_errorbars(ax, xerr=0, yerr=2)
15771544

1578-
@pytest.mark.slow
15791545
def test_errorbar_with_integer_column_names(self):
15801546
# test with integer column names
15811547
df = DataFrame(np.random.randn(10, 2))
@@ -1585,7 +1551,6 @@ def test_errorbar_with_integer_column_names(self):
15851551
ax = _check_plot_works(df.plot, y=0, yerr=1)
15861552
self._check_has_errorbars(ax, xerr=0, yerr=1)
15871553

1588-
@pytest.mark.slow
15891554
def test_errorbar_with_partial_columns(self):
15901555
df = DataFrame(np.random.randn(10, 3))
15911556
df_err = DataFrame(np.random.randn(10, 2), columns=[0, 2])
@@ -1608,7 +1573,6 @@ def test_errorbar_with_partial_columns(self):
16081573
ax = _check_plot_works(df.plot, yerr=err)
16091574
self._check_has_errorbars(ax, xerr=0, yerr=1)
16101575

1611-
@pytest.mark.slow
16121576
@pytest.mark.parametrize("kind", ["line", "bar", "barh"])
16131577
def test_errorbar_timeseries(self, kind):
16141578
d = {"x": np.arange(12), "y": np.arange(12, 0, -1)}
@@ -1713,7 +1677,6 @@ def _check_errorbar_color(containers, expected, has_err="has_xerr"):
17131677
self._check_has_errorbars(ax, xerr=0, yerr=1)
17141678
_check_errorbar_color(ax.containers, "green", has_err="has_yerr")
17151679

1716-
@pytest.mark.slow
17171680
def test_sharex_and_ax(self):
17181681
# https://github.com/pandas-dev/pandas/issues/9737 using gridspec,
17191682
# the axis in fig.get_axis() are sorted differently than pandas
@@ -1768,7 +1731,6 @@ def _check(axes):
17681731
self._check_visible(ax.get_xticklabels(minor=True), visible=True)
17691732
tm.close()
17701733

1771-
@pytest.mark.slow
17721734
def test_sharey_and_ax(self):
17731735
# https://github.com/pandas-dev/pandas/issues/9737 using gridspec,
17741736
# the axis in fig.get_axis() are sorted differently than pandas
@@ -1854,7 +1816,6 @@ def test_memory_leak(self):
18541816
# need to actually access something to get an error
18551817
results[key].lines
18561818

1857-
@pytest.mark.slow
18581819
def test_df_gridspec_patterns(self):
18591820
# GH 10819
18601821
import matplotlib.gridspec as gridspec
@@ -1970,7 +1931,6 @@ def _get_boxed_grid():
19701931
self._check_visible(ax.get_xticklabels(minor=True), visible=True)
19711932
tm.close()
19721933

1973-
@pytest.mark.slow
19741934
def test_df_grid_settings(self):
19751935
# Make sure plot defaults to rcParams['axes.grid'] setting, GH 9792
19761936
self._check_grid_settings(
@@ -2026,7 +1986,6 @@ def test_secondary_axis_font_size(self, method):
20261986
ax = getattr(df.plot, method)(**kwargs)
20271987
self._check_ticks_props(axes=ax.right_ax, ylabelsize=fontsize)
20281988

2029-
@pytest.mark.slow
20301989
def test_x_string_values_ticks(self):
20311990
# Test if string plot index have a fixed xtick position
20321991
# GH: 7612, GH: 22334
@@ -2046,7 +2005,6 @@ def test_x_string_values_ticks(self):
20462005
assert labels_position["Tuesday"] == 1.0
20472006
assert labels_position["Wednesday"] == 2.0
20482007

2049-
@pytest.mark.slow
20502008
def test_x_multiindex_values_ticks(self):
20512009
# Test if multiindex plot index have a fixed xtick position
20522010
# GH: 15912
@@ -2190,7 +2148,6 @@ def test_xlabel_ylabel_dataframe_plane_plot(self, kind, xlabel, ylabel):
21902148
assert ax.get_xlabel() == (xcol if xlabel is None else xlabel)
21912149
assert ax.get_ylabel() == (ycol if ylabel is None else ylabel)
21922150

2193-
@pytest.mark.slow
21942151
@pytest.mark.parametrize("method", ["bar", "barh"])
21952152
def test_bar_ticklabel_consistence(self, method):
21962153
# Draw two consecutiv bar plot with consistent ticklabels

0 commit comments

Comments
 (0)