We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e0dc09b commit 146883bCopy full SHA for 146883b
lib/matplotlib/testing/conftest.py
@@ -43,7 +43,16 @@ def mpl_test_settings(request):
43
# This import must come after setup() so it doesn't load the
44
# default backend prematurely.
45
import matplotlib.pyplot as plt
46
- plt.switch_backend(backend)
+ try:
47
+ plt.switch_backend(backend)
48
+ except ImportError as exc:
49
+ # Should only occur for the cairo backend tests, if neither
50
+ # pycairo nor cairocffi are installed.
51
+ if 'cairo' in backend.lower():
52
+ pytest.skip("Failed to switch to backend {} ({})."
53
+ .format(backend, exc))
54
+ else:
55
+ raise
56
with warnings.catch_warnings():
57
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
58
matplotlib.style.use(style)
0 commit comments