From 00d5570d1d2bdc67f3b75b30048282606456d13f Mon Sep 17 00:00:00 2001 From: Daniel Martin Date: Fri, 18 Jun 2021 05:19:44 +0000 Subject: [PATCH] Fix tests (broken on newer versions of pytest-qt) --- tests/conftest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 530a617c4..ec2862295 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -43,7 +43,12 @@ from openlp.core.common.settings import Settings @pytest.fixture def qapp(qtbot): """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() yield app del app