FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Don't fail tests if cairo dependency is not installed. by anntzer · Pull Request #12835 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 10 additions & 1 deletion lib/matplotlib/testing/conftest.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ def mpl_test_settings(request):
# This import must come after setup() so it doesn't load the
# default backend prematurely.
import matplotlib.pyplot as plt
plt.switch_backend(backend)
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():
pytest.skip("Failed to switch to backend {} ({})."
.format(backend, exc))
else:
raise
with warnings.catch_warnings():
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
matplotlib.style.use(style)
Expand Down

Back | FazBrowse Home | New Git URL