python-matplotlib/0003-TST-Ignore-deprecations-when-switching-backends.patch
Elliott Sales de Andrade 26c79f2797 Update to latest version.
2020-07-19 02:41:37 -04:00

57 lines
2.4 KiB
Diff

From d54cb926a832a39cee06b677203f8a3d5ff2f084 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Sat, 18 Jul 2020 21:40:26 -0400
Subject: [PATCH 3/3] TST: Ignore deprecations when switching backends.
Otherwise, stuff like Qt4 backend cannot be tested because the
deprecation warning will cause a failure.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/matplotlib/testing/conftest.py | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/lib/matplotlib/testing/conftest.py b/lib/matplotlib/testing/conftest.py
index 563a9fc0f..391dd5d49 100644
--- a/lib/matplotlib/testing/conftest.py
+++ b/lib/matplotlib/testing/conftest.py
@@ -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
--
2.25.4