aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pmstestsuite/library/standard/dbus_case.py')
-rw-r--r--pmstestsuite/library/standard/dbus_case.py32
1 files changed, 11 insertions, 21 deletions
diff --git a/pmstestsuite/library/standard/dbus_case.py b/pmstestsuite/library/standard/dbus_case.py
index 672ace5..ac9c4d1 100644
--- a/pmstestsuite/library/standard/dbus_case.py
+++ b/pmstestsuite/library/standard/dbus_case.py
@@ -1,5 +1,5 @@
# vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.
import dbus.service
@@ -13,30 +13,26 @@ from pmstestsuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_obj
dbus_handler = DBusHandler()
-class RunningTest(dbus.service.Object):
- """ A class encapsulating a running test. """
+class DBusBaseTestCase(dbus.service.Object):
+ """ A base D-Bus test case class. """
- def __init__(self, test):
+ def __init__(self):
"""
- Initialize the D-Bus object for the test.
-
- @param test: the test
- @type test: L{TestCase}
+ Initialize the D-Bus interface for the test.
"""
- self.test = test
self.reset()
dbus.service.Object.__init__(
self,
dbus_handler.bus,
- '%s/%s' % (dbus_object_prefix, test.p.replace('-', '_'))
+ '%s/%s' % (dbus_object_prefix, self.p.replace('-', '_'))
)
def reset(self):
"""
Reset test results.
"""
- self.test.dbus_output = []
- self.test.dbus_started = False
+ self.dbus_output = []
+ self.dbus_started = False
@dbus.service.method(
dbus_interface=dbus_interface_name,
@@ -45,7 +41,7 @@ class RunningTest(dbus.service.Object):
"""
Notify the test suite that a particular test has been started.
"""
- self.test.dbus_started = True
+ self.dbus_started = True
@dbus.service.method(
dbus_interface=dbus_interface_name,
@@ -57,13 +53,7 @@ class RunningTest(dbus.service.Object):
@param l: result string
@type l: C{dbus.UTF8String}
"""
- self.test.dbus_output.append(str(l))
-
-class DBusBaseTestCase(object):
- """ A base D-Bus test case class. """
-
- def __init__(self):
- self._dbusobj = RunningTest(self)
+ self.dbus_output.append(str(l))
def _finalize(self):
"""
@@ -92,7 +82,7 @@ class DBusBaseTestCase(object):
def _pop_dbus_output(self):
ret = self.dbus_output
- self._dbusobj.reset()
+ self.reset()
return ret
def check_result(self, pm):