Remove QApplication.instance() deleteLater call

the test_signalproxy.py had a fixture for the QApplication instance,
only problem is at the end of each use of the fixture, it would mark
the application instance for deletion, which is most definitely not what
we want
This commit is contained in:
Ogi Moore 2021-05-28 00:34:29 -07:00
parent a6971c768d
commit 0160de22fb
1 changed files with 2 additions and 21 deletions

View File

@ -1,7 +1,7 @@
import sys
import pytest
from pyqtgraph.Qt import QtCore, QtGui, QT_LIB, PYSIDE
from pyqtgraph.Qt import QtCore, QtGui, QT_LIB, mkQApp
from pyqtgraph import SignalProxy
@ -24,13 +24,11 @@ class Receiver(QtCore.QObject):
@pytest.fixture
def qapp():
app = QtGui.QApplication.instance()
app = mkQApp()
if app is None:
app = QtGui.QApplication(sys.argv)
yield app
app.processEvents(QtCore.QEventLoop.AllEvents, 100)
app.deleteLater()
def test_signal_proxy_slot(qapp):
@ -50,13 +48,8 @@ def test_signal_proxy_slot(qapp):
qapp.processEvents(QtCore.QEventLoop.AllEvents, 10)
assert receiver.counter > 0
del proxy
del sender
del receiver
@pytest.mark.skipif(QT_LIB == PYSIDE and sys.version_info < (2, 8),
reason="Crashing on PySide and Python 2.7")
def test_signal_proxy_disconnect_slot(qapp):
"""Test the disconnect of SignalProxy with `signal` and `slot`"""
sender = Sender(parent=qapp)
@ -80,10 +73,6 @@ def test_signal_proxy_disconnect_slot(qapp):
assert receiver.counter == 0
del proxy
del sender
del receiver
def test_signal_proxy_no_slot_start(qapp):
"""Test the connect mode of SignalProxy without slot at start`"""
@ -113,10 +102,6 @@ def test_signal_proxy_no_slot_start(qapp):
with pytest.raises(AssertionError):
proxy.connectSlot(receiver.slotReceive)
del proxy
del sender
del receiver
def test_signal_proxy_slot_block(qapp):
"""Test the block mode of SignalProxy with `signal` and `slot`"""
@ -144,7 +129,3 @@ def test_signal_proxy_slot_block(qapp):
qapp.processEvents(QtCore.QEventLoop.AllEvents, 10)
assert receiver.counter > 0
del proxy
del sender
del receiver