forked from FAForever/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
36 lines (26 loc) · 880 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
__author__ = 'Thygrrr'
import pytest
import sys
from PyQt4 import QtGui, QtCore
@pytest.fixture(scope="module")
def application(request):
request.app = QtGui.QApplication(sys.argv)
request.app.setApplicationName("py.test QApplication")
def finalize():
request.app.quit()
request.addfinalizer(finalize)
return request.app
@pytest.fixture(scope="function")
def signal_receiver(application):
class SignalReceiver(QtCore.QObject):
def __init__(self, parent=None):
QtCore.QObject.__init__(self, parent)
self.int_values = []
self.generic_values = []
@QtCore.pyqtSlot()
def generic_slot(self):
self.generic_values.append(None)
@QtCore.pyqtSlot(int)
def int_slot(self, value):
self.int_values.append(value)
return SignalReceiver(application)