Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Mar 17, 2023

Conversation

ayshih
Copy link
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
Contributor

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

@ayshih
Copy link
Contributor Author

ayshih commented Mar 17, 2023

Oops, number now updated

@larsoner
Copy link
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
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
12 of 13 checks passed
@larsoner
Copy link
Contributor

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

@ayshih
Copy link
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.

None yet

2 participants