Skip to content

Commit a3a382f

Browse files
committed
Do not call QApplication.exit() and keep a global reference
1 parent 5e872b0 commit a3a382f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pytestqt/plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,14 @@ def qapp():
380380
"""
381381
app = QApplication.instance()
382382
if app is None:
383-
app = QApplication([])
383+
global _qapp_instance
384+
_qapp_instance = QApplication([])
384385
yield app
385-
app.exit()
386-
app.deleteLater()
387386
else:
388387
yield app # pragma: no cover
389388

389+
_qapp_instance = None
390+
390391

391392
@pytest.yield_fixture
392393
def qtbot(qapp, request):
@@ -397,7 +398,6 @@ def qtbot(qapp, request):
397398
that they are properly closed after the test ends.
398399
"""
399400
result = QtBot(qapp)
400-
assert 0
401401
no_capture = request.node.get_marker('qt_no_exception_capture') or \
402402
request.config.getini('qt_no_exception_capture')
403403
if no_capture:

0 commit comments

Comments
 (0)