You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have both PySide2 and PyQt5 in the environment, I get the following test failure:
$ pytest tests/test_magicgui.py::test_auto_call
=============================== test session starts ===============================
platform linux -- Python 3.8.2, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- /home/jni/miniconda3/envs/all/bin/python
cachedir: .pytest_cache
PySide2 5.14.2.1 -- Qt runtime 5.14.2 -- Qt compiled 5.14.2
rootdir: /home/jni/projects/magicgui, configfile: setup.cfgplugins: mypy-plugins-1.6.1, napari-plugin-engine-0.1.9, timeout-1.3.4, httpserver-0.3.4, ordering-0.6, qt-3.3.0, cov-2.8.1, napari-0.4.4.dev89+ge33c2fd1
collected 1 item
tests/test_magicgui.py::test_auto_call FAILED [100%]
==================================== FAILURES =====================================
_________________________________ test_auto_call __________________________________
qtbot = <pytestqt.qtbot.QtBot object at 0x7f0d8dce2940>
magic_func = <FunctionGui func(a: str = 'works', b: int = 6, c=7.1) -> str>
deftest_auto_call(qtbot, magic_func):
"""Test that changing a parameter calls the function."""#TODO: remove qtbot requirement so we can test other backends eventually.# changing the widget parameter calls the functionwith qtbot.waitSignal(magic_func.called, timeout=1000):
magic_func.b.value =6# changing the gui calls the functionwith qtbot.waitSignal(magic_func.called, timeout=1000):
> qtbot.keyClick(magic_func.a.native, Qt.Key_A, Qt.ControlModifier)
tests/test_magicgui.py:131:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<PyQt5.QtWidgets.QLineEdit object at 0x7f0d917079d0>, 65, 67108864)
kwargs = {}
defresult(*args, **kwargs):
> return qtest_method(*args, **kwargs)
E TypeError: 'PySide2.QtTest.QTest.keyClick' called with wrong argument types:
E PySide2.QtTest.QTest.keyClick(QLineEdit, Key, KeyboardModifier)
E Supported signatures:
E PySide2.QtTest.QTest.keyClick(PySide2.QtWidgets.QWidget, PySide2.QtCore.Qt.Key, PySide2.QtCore.Qt.KeyboardModifiers = PySide2.QtCore.Qt.KeyboardModifier.NoModifier, int = -1)
E PySide2.QtTest.QTest.keyClick(PySide2.QtWidgets.QWidget, typing.Char, PySide2.QtCore.Qt.KeyboardModifiers = PySide2.QtCore.Qt.KeyboardModifier.NoModifier, int = -1)
E PySide2.QtTest.QTest.keyClick(PySide2.QtGui.QWindow, PySide2.QtCore.Qt.Key, PySide2.QtCore.Qt.KeyboardModifiers = PySide2.QtCore.Qt.KeyboardModifier.NoModifier, int = -1)
E PySide2.QtTest.QTest.keyClick(PySide2.QtGui.QWindow, typing.Char, PySide2.QtCore.Qt.KeyboardModifiers = PySide2.QtCore.Qt.KeyboardModifier.NoModifier, int = -1)
../../miniconda3/envs/all/lib/python3.8/site-packages/pytestqt/qtbot.py:626: TypeError
============================= short test summary info =============================
FAILED tests/test_magicgui.py::test_auto_call - TypeError: 'PySide2.QtTest.QTest...
================================ 1 failed in 0.22s ================================
Using QT_API=PySide2 pytest tests/test_magicgui.py::test_auto_call resolves the problem, but QT_API=PyQt5 pytest tests/test_magicgui.py::test_auto_call does not. So it seems pytest-qtbot is choosing PySide2 and ignoring the QT_API variable.
Expected behavior
Failure could be "expected" and marked as xfail, or magicgui could match pytest-qtbot during testing.
Environment (please complete the following information):
Describe the bug
If I have both PySide2 and PyQt5 in the environment, I get the following test failure:
Using
QT_API=PySide2 pytest tests/test_magicgui.py::test_auto_call
resolves the problem, butQT_API=PyQt5 pytest tests/test_magicgui.py::test_auto_call
does not. So it seems pytest-qtbot is choosing PySide2 and ignoring the QT_API variable.Expected behavior
Failure could be "expected" and marked as xfail, or magicgui could match pytest-qtbot during testing.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: