-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
TST: properly fence-post qt{4,5} backend tests #5195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This issue is that the new 'default' qt version is 5 if it is available. In the tests the backend is Agg so we are hitting the fall through behavior. If both pyqt4 and pyqt5 are installed, then `QtCore` will be from PyQt5, but the backend_qt4Agg code assumes that it is seeing the PyQt4 version of the classes. This results in error on `__init__` due to the change between PyQt4 and PyQt5. Added test_backend_qt5.py to white listed tests. closes matplotlib#5194
This addresses one of the problems, but now the qt4 test segfaults on exit with pyqt4 and durring the tests with pyside |
and it seems that pyside is just flat out broken now...hurray |
Do not let a `super` be called or the the c++ base-classes will be initialized twice which causes havoc. - pyside failed on figure creation - pyqt4 may segfault on exit closes matplotlib#5196
If: 1. backend is not Qt{4,5}Agg 2. PyQt4 and PySide are installed, PyQt5 is not 3. backend.qt4 == 'PySide' The fall through will start trying to import PyQt5 (so sip will be imported as it is installed for PyQt4). It will then fall back to Qt4 using the binding specified in the rcparam ('PySide') which will then miss the qt4 import conditionals which means QtCore is never imported which means we get name errors from the pyqt / pyside patch up code. This catches those exceptions and gives pyside a chance to be imported.
@sandrotosi This should fix this round of errors 😸 |
@@ -133,7 +135,7 @@ def test_control_alt(): | |||
def test_modifier_order(): | |||
assert_correct_key(QtCore.Qt.Key_Aacute, | |||
(ControlModifier | AltModifier | SuperModifier), | |||
'ctrl+alt+super+' + unichr(225)) | |||
'ctrl+alt+super+' + chr(225)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be six.unichr so it doesn't fail if the default encoding is something that can't handle Unicode codepoint 225...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as i know pyqt5 is py3 so I thought this was fine.
On Tue, Oct 6, 2015, 08:37 Michael Droettboom [email protected]
wrote:
In lib/matplotlib/tests/test_backend_qt5.py
#5195 (comment):@@ -133,7 +135,7 @@ def test_control_alt():
def test_modifier_order():
assert_correct_key(QtCore.Qt.Key_Aacute,
(ControlModifier | AltModifier | SuperModifier),
'ctrl+alt+super+' + unichr(225))
'ctrl+alt+super+' + chr(225))
Maybe this should be six.unichr so it doesn't fail if the default encoding
is something that can't handle Unicode codepoint 225...—
Reply to this email directly or view it on GitHub
https://github.com/matplotlib/matplotlib/pull/5195/files#r41257615.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyqt5 also runs on python 2.7
cool, thanks @tacaswell ! I'm going to test those patches right now |
One gotcha of this is that we can not test both pyqt4, pyside, and qt5 in the same process as their imports fight with each other. |
I can confim those commits fix the tests errors! |
TST: properly fence-post qt{4,5} backend tests
This issue is that the new 'default' qt version is 5 if it is
available. In the tests the backend is Agg so we are hitting the
fall through behavior. If both pyqt4 and pyqt5 are installed, then
QtCore
will be from PyQt5, but the backend_qt4Agg code assumes that itis seeing the PyQt4 version of the classes. This results in error on
__init__
due to the change between PyQt4 and PyQt5.Added test_backend_qt5.py to white listed tests.
closes #5194