Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4cfaa9e

Browse files
committed
Skip the tests requiring Qt5
1 parent 92a3b53 commit 4cfaa9e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/matplotlib/tests/test_backend_qt.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
import pytest
1010

1111

12+
try:
13+
from matplotlib.backends.qt_compat import QtGui
14+
except ImportError:
15+
pytestmark = pytest.mark.skip('No usable Qt5 bindings')
16+
17+
1218
@pytest.fixture
1319
def qt_core(request):
1420
backend, = request.node.get_closest_marker('backend').args

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
# versions so we don't fail on missing backends.
1919

2020
def _get_testable_interactive_backends():
21+
try:
22+
from matplotlib.backends.qt_compat import QtGui
23+
have_qt5 = True
24+
except ImportError:
25+
have_qt5 = False
26+
2127
backends = []
2228
for deps, backend in [
2329
(["cairo", "gi"], "gtk3agg"),
@@ -39,6 +45,8 @@ def _get_testable_interactive_backends():
3945
reason = "{} cannot be imported".format(", ".join(missing))
4046
elif backend == 'macosx' and os.environ.get('TF_BUILD'):
4147
reason = "macosx backend fails on Azure"
48+
elif 'qt5' in backend and not have_qt5:
49+
reason = "no usable Qt5 bindings"
4250
if reason:
4351
backend = pytest.param(
4452
backend,

0 commit comments

Comments
 (0)