File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 33import sys
44
55import pytest
6+ from packaging .version import parse
67
78from qtpy import (
89 PYQT5 ,
910 PYQT_VERSION ,
1011 PYSIDE2 ,
1112 PYSIDE6 ,
13+ QT_VERSION ,
1214 QtCore ,
1315 QtGui ,
1416 QtWidgets ,
@@ -189,11 +191,28 @@ def test_QAction_functions(qtbot):
189191 action .setShortcuts (QtGui .QKeySequence .UnknownKey )
190192 action .setShortcut (QtCore .Qt .Key_F1 )
191193 action .setShortcuts ([QtCore .Qt .Key_F1 ])
192- # The following line is wrong even for Qt6 == 6.6.
194+ # The following line fails even for Qt6 == 6.6.
193195 # Don't test the function with a single `QtCore.Qt.Key` argument.
196+ # See the following test.
194197 # action.setShortcuts(QtCore.Qt.Key_F1)
195198
196199
200+ @pytest .mark .skipif (
201+ parse (QT_VERSION ) < parse ('6.5.0' ),
202+ reason = "Qt6 >= 6.5 specific test" ,
203+ )
204+ @pytest .mark .skipif (
205+ sys .platform == "darwin" and sys .version_info [:2 ] == (3 , 7 ),
206+ reason = "Stalls on macOS CI with Python 3.7" ,
207+ )
208+ @pytest .mark .xfail (strict = True )
209+ def test_QAction_functions_fail (qtbot ):
210+ """Test `QtGui.QAction.setShortcuts` compatibility with `QtCore.Qt.Key` type."""
211+ action = QtGui .QAction ("QtPy" , None )
212+ # The following line is wrong even for Qt6 == 6.6.
213+ action .setShortcuts (QtCore .Qt .Key_F1 )
214+
215+
197216def test_opengl_imports ():
198217 """
199218 Test for presence of QOpenGL* classes.
You can’t perform that action at this time.
0 commit comments