aboutsummaryrefslogtreecommitdiffstats
path: root/tests/signals
diff options
context:
space:
mode:
authorLauro Neto <lauro.neto@openbossa.org>2009-12-15 17:15:03 -0300
committerLauro Neto <lauro.neto@openbossa.org>2009-12-16 21:14:24 -0300
commitffd0b47222e9a46615c9f86a3eb9aa034579acee (patch)
tree5f2149262c5dadc67b24273e03f1c09e72838c11 /tests/signals
parent976cbf00293016ba4e173f4e89de92790fdf06c0 (diff)
Fixing pysignal_tests with helper classes
Diffstat (limited to 'tests/signals')
-rw-r--r--tests/signals/pysignal_test.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/signals/pysignal_test.py b/tests/signals/pysignal_test.py
index 923d8b782..6409fa2c2 100644
--- a/tests/signals/pysignal_test.py
+++ b/tests/signals/pysignal_test.py
@@ -1,7 +1,16 @@
import unittest
from PySide.QtCore import QObject, SIGNAL, SLOT
-from PySide.QtGui import QSpinBox, QApplication, QWidget
+
+try:
+ from PySide.QtGui import QSpinBox, QApplication, QWidget
+except ImportError:
+ QSpinBox = object
+ QApplication = object
+ QWidget = object
+
+from helper import UsesQApplication
+from helper.decorators import requires
class Dummy(QObject):
"""Dummy class used in this test."""
@@ -42,19 +51,19 @@ class PythonSigSlot(unittest.TestCase):
self.assert_(self.called)
-app = QApplication([])
-class SpinBoxPySignal(unittest.TestCase):
+@requires('PySide.QtGui')
+class SpinBoxPySignal(UsesQApplication):
"""Tests the connection of python signals to QSpinBox qt slots."""
- qapplication = True
-
def setUp(self):
+ super(SpinBoxPySignal, self).setUp()
self.obj = Dummy()
self.spin = QSpinBox()
self.spin.setValue(0)
def tearDown(self):
+ super(SpinBoxPySignal, self).tearDown()
del self.obj
del self.spin
@@ -78,16 +87,17 @@ class SpinBoxPySignal(unittest.TestCase):
self.assertEqual(self.spin.value(), 77)
-class WidgetPySignal(unittest.TestCase):
+@requires('PySide.QtGui')
+class WidgetPySignal(UsesQApplication):
"""Tests the connection of python signals to QWidget qt slots."""
- qapplication = True
-
def setUp(self):
+ super(WidgetPySignal, self).setUp()
self.obj = Dummy()
self.widget = QWidget()
def tearDown(self):
+ super(WidgetPySignal, self).tearDown()
del self.obj
del self.widget