Skip to content

Add test for setting a non-agg Matplotlib backend#1104

Merged
larsoner merged 2 commits intosphinx-gallery:masterfrom
ayshih:backend_test
Mar 17, 2023
Merged

Add test for setting a non-agg Matplotlib backend#1104
larsoner merged 2 commits intosphinx-gallery:masterfrom
ayshih:backend_test

Conversation

@ayshih
Copy link
Copy Markdown
Contributor

@ayshih ayshih commented Mar 16, 2023

This PR adds a regression test for #1102 via an example within tinybuild in the test suite. If the Matplotlib backend is reset to agg between code blocks, the example will raise an AssertionError during the build of tinybuild.

@larsoner
Copy link
Copy Markdown
Contributor

I think you need to adjust the number of examples expected in tinybuild / sphinx_gallery/tests/test_full.py

@ayshih
Copy link
Copy Markdown
Contributor Author

ayshih commented Mar 17, 2023

Oops, number now updated

@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Mar 17, 2023

So far so good! Based on https://output.circle-artifacts.com/output/job/0dc682b1-1c23-4719-81d6-6e26cec1a970/artifacts/0/tiny_html/auto_examples/plot_matplotlib_backend.html it seems like a good test would be to check in test_full.py something like assert html_output.count('Matplotlib backend is svg') == 2, no?

@ayshih
Copy link
Copy Markdown
Contributor Author

ayshih commented Mar 17, 2023

Sure, I can check the example print output in a unit test, but I should presumably then remove the assert statements in the example itself. If there is a regression, those assert statements would cause to the build to fail before the unit test even has a chance to run.

@larsoner larsoner merged commit 9a523bb into sphinx-gallery:master Mar 17, 2023
@larsoner
Copy link
Copy Markdown
Contributor

Ahh you're right, somehow I missed the assert statements. Good enough, thanks @ayshih !

@ayshih
Copy link
Copy Markdown
Contributor Author

ayshih commented Mar 17, 2023

Okay, great!

@ayshih ayshih deleted the backend_test branch March 17, 2023 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants