Skip to content

Commit

Permalink
Test run: create an instance of QApplication before pytestqt crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
StSav012 committed Feb 18, 2023
1 parent 6c90643 commit e90bb1a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions qtpy/tests/test_qtgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
from qtpy.tests.utils import not_using_conda


# This may prevent the crashes on Ubuntu with `conda=No`
def _qapp():
return QtWidgets.QApplication.instance() or QtWidgets.QApplication([sys.executable, __file__])


@pytest.mark.skipif(
sys.platform.startswith('linux') and not_using_conda(),
reason="Fatal Python error: Aborted on Linux CI when not using conda")
Expand Down Expand Up @@ -62,13 +67,7 @@ def test_enum_access():
assert QtGui.QImage.Format_Invalid == QtGui.QImage.Format.Format_Invalid


@pytest.mark.skipif(
sys.platform.startswith('linux') and not_using_conda(),
reason="Fatal Python error: Aborted on Linux CI when not using conda")
@pytest.mark.skipif(
sys.platform == 'darwin' and sys.version_info[:2] == (3, 7),
reason="Stalls on macOS CI with Python 3.7")
def test_QMouseEvent_pos_functions(qtbot):
def test_QMouseEvent_pos_functions(qtbot, app=_qapp()):
"""
Test `QMouseEvent.pos` and related functions removed in Qt 6,
and `QMouseEvent.position`, etc., missing from Qt 5.
Expand Down

0 comments on commit e90bb1a

Please sign in to comment.