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

Matplotlib 3.8 test warning #2277

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/cartopy/tests/mpl/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def mpl_test_cleanup(request):
with ExitStack() as stack:
# At exit, close all open figures and switch backend back to original.
stack.callback(plt.switch_backend, plt.get_backend())
stack.callback(plt.close, 'all')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter whether we close all before or after the switch backend?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if line 17 and 18 are swapped the warning is still given. Since the stack goes in reverse order, I think the flow is that on exit the plot is closed, then backend is switched to original.


# Run each test in a context manager so that state does not leak out
plt.switch_backend('Agg')
Expand Down