From ce8960793dfb3e891493e3805928d44cd7e56e70 Mon Sep 17 00:00:00 2001 From: "Albert Y. Shih" Date: Wed, 15 Mar 2023 23:24:46 -0400 Subject: [PATCH 1/2] Add test for setting a non-agg Matplotlib backend --- .../examples/plot_matplotlib_backend.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 sphinx_gallery/tests/tinybuild/examples/plot_matplotlib_backend.py diff --git a/sphinx_gallery/tests/tinybuild/examples/plot_matplotlib_backend.py b/sphinx_gallery/tests/tinybuild/examples/plot_matplotlib_backend.py new file mode 100644 index 000000000..070b011b2 --- /dev/null +++ b/sphinx_gallery/tests/tinybuild/examples/plot_matplotlib_backend.py @@ -0,0 +1,24 @@ +""" +Setting the Matplotlib backend +============================== +""" + +# %% +# The Matplotlib backend should start as `agg` + +import matplotlib +print(f"Matplotlib backend is {matplotlib.get_backend()}") +assert matplotlib.get_backend() == "agg" + +# %% +# Changing the Matplotlib backend to `svg` should be possible + +matplotlib.use("svg") +print(f"Matplotlib backend is {matplotlib.get_backend()}") +assert matplotlib.get_backend() == "svg" + +# %% +# In a new code block, the Matplotlib backend should continue to be `svg` + +print(f"Matplotlib backend is {matplotlib.get_backend()}") +assert matplotlib.get_backend() == "svg" From bfe8f2cca3d24a0397a5cd878ffb6fd3fc667270 Mon Sep 17 00:00:00 2001 From: "Albert Y. Shih" Date: Thu, 16 Mar 2023 23:02:43 -0400 Subject: [PATCH 2/2] Update the number of examples --- sphinx_gallery/tests/test_full.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_gallery/tests/test_full.py b/sphinx_gallery/tests/test_full.py index a90defc60..9983c5be7 100644 --- a/sphinx_gallery/tests/test_full.py +++ b/sphinx_gallery/tests/test_full.py @@ -30,7 +30,7 @@ # total number of plot_*.py files in tinybuild/examples + examples_rst_index # + examples_with_rst -N_EXAMPLES = 13 + 3 + 2 +N_EXAMPLES = 14 + 3 + 2 N_FAILING = 2 N_GOOD = N_EXAMPLES - N_FAILING # galleries that run w/o error # passthroughs examples_rst_index, examples_with_rst