10000 Backport PR #17963 on branch v3.3.x (TST: Ignore deprecations when switching backends.) by meeseeksmachine · Pull Request #18024 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Backport PR #17963 on branch v3.3.x (TST: Ignore deprecations when switching backends.) #18024

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

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
28 changes: 14 additions & 14 deletions lib/matplotlib/testing/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ def mpl_test_settings(request):
style, = style_marker.args

matplotlib.testing.setup()
if backend is not None:
# This import must come after setup() so it doesn't load the
# default backend prematurely.
import matplotlib.pyplot as plt
try:
plt.switch_backend(backend)
except ImportError as exc:
# Should only occur for the cairo backend tests, if neither
# pycairo nor cairocffi are installed.
if 'cairo' in backend.lower() or skip_on_importerror:
pytest.skip("Failed to switch to backend {} ({})."
.format(backend, exc))
else:
raise
with cbook._suppress_matplotlib_deprecation_warning():
if backend is not None:
# This import must come after setup() so it doesn't load the
# default backend prematurely.
import matplotlib.pyplot as plt
try:
plt.switch_backend(backend)
except ImportError as exc:
# Should only occur for the cairo backend tests, if neither
# pycairo nor cairocffi are installed.
if 'cairo' in backend.lower() or skip_on_importerror:
pytest.skip("Failed to switch to backend {} ({})."
.format(backend, exc))
else:
raise
matplotlib.style.use(style)
try:
yield
Expand Down
0