Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 29a25b9

Browse filesBrowse files
committed
TST: be more explicit about identifying qt4/qt5 imports
closes #14137
1 parent 7001b33 commit 29a25b9
Copy full SHA for 29a25b9

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed

‎lib/matplotlib/tests/test_backend_qt.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_qt.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import copy
2+
import sys
23
from unittest import mock
34

45
import matplotlib
@@ -26,6 +27,8 @@ def mpl_test_settings(qt_module, mpl_test_settings):
2627
def qt_module(request):
2728
backend, = request.node.get_closest_marker('backend').args
2829
if backend == 'Qt4Agg':
30+
if any(k in sys.modules for k in ('PyQt5', 'PySide2')):
31+
pytest.skip('Qt5 binding already imported')
2932
try:
3033
import PyQt4
3134
# RuntimeError if PyQt5 already imported.
@@ -35,6 +38,8 @@ def qt_module(request):
3538
except ImportError:
3639
pytest.skip("Failed to import a Qt4 binding.")
3740
elif backend == 'Qt5Agg':
41+
if any(k in sys.modules for k in ('PyQt4', 'PySide')):
42+
pytest.skip('Qt4 binding already imported')
3843
try:
3944
import PyQt5
4045
# RuntimeError if PyQt4 already imported.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.