aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2012-01-02 22:29:24 +0100
committerMichał Górny <mgorny@gentoo.org>2012-01-02 22:29:24 +0100
commit6f58b9a9bc5a1e7314336caec10acabe751d1f94 (patch)
treed14d91350ad6b9d1b5c671dcb2d5255abdec80cb /pmstestsuite
parentIntegrate D-Bus code into the main eclass. (diff)
downloadpms-test-suite-6f58b9a9bc5a1e7314336caec10acabe751d1f94.tar.gz
pms-test-suite-6f58b9a9bc5a1e7314336caec10acabe751d1f94.tar.bz2
pms-test-suite-6f58b9a9bc5a1e7314336caec10acabe751d1f94.zip
Integrate the D-Bus object with base D-Bus test case class.
Diffstat (limited to 'pmstestsuite')
-rw-r--r--pmstestsuite/library/case.py4
-rw-r--r--pmstestsuite/library/standard/dbus_case.py32
2 files changed, 13 insertions, 23 deletions
diff --git a/pmstestsuite/library/case.py b/pmstestsuite/library/case.py
index a5817fb..614a500 100644
--- a/pmstestsuite/library/case.py
+++ b/pmstestsuite/library/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 copy, itertools, random, re
@@ -227,7 +227,7 @@ class NotEqualAssertionResult(EqualAssertionResult):
return '%s != %s' % (self.actual,
repr(self._expect))
-class TestCase(ABCObject):
+class TestCase(object): # was: ABCObject
"""
Base class for a test case.
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):