Skip to content
10 changes: 10 additions & 0 deletions pandas/tests/plotting/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
)


@pytest.fixture(autouse=True)
def non_interactive():
mpl = pytest.importorskip("matplotlib")
mpl.use("template")
yield


@pytest.fixture(autouse=True)
def reset_rcParams():
mpl = pytest.importorskip("matplotlib")
Expand All @@ -16,8 +23,11 @@ def reset_rcParams():

@pytest.fixture(autouse=True)
def close_all_figures():
# https://stackoverflow.com/q/31156578
yield
plt = pytest.importorskip("matplotlib.pyplot")
plt.cla()
plt.clf()
plt.close("all")


Expand Down