Merge branch 'fix_tests' into 'master'

Fix tests (broken on newer versions of pytest-qt)

See merge request openlp/openlp!332
This commit is contained in:
Raoul Snyman 2021-06-18 05:19:44 +00:00
commit 88f7a805f8

View File

@ -43,7 +43,12 @@ from openlp.core.common.settings import Settings
@pytest.fixture @pytest.fixture
def qapp(qtbot): def qapp(qtbot):
"""An instance of QApplication""" """An instance of QApplication"""
qt_api.QApplication.instance() # Newer versions of pytest-qt have QApplication in the widgets module.
# Catch attribute error if the widgets module is missing and instantiate QApplication the old way.
try:
qt_api.QtWidgets.QApplication.instance()
except AttributeError:
qt_api.QApplication.instance()
app = OpenLP() app = OpenLP()
yield app yield app
del app del app