1 |
commit: 6f58b9a9bc5a1e7314336caec10acabe751d1f94 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jan 2 21:29:24 2012 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 2 21:29:24 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=6f58b9a9 |
7 |
|
8 |
Integrate the D-Bus object with base D-Bus test case class. |
9 |
|
10 |
--- |
11 |
pmstestsuite/library/case.py | 4 +- |
12 |
pmstestsuite/library/standard/dbus_case.py | 32 +++++++++------------------ |
13 |
2 files changed, 13 insertions(+), 23 deletions(-) |
14 |
|
15 |
diff --git a/pmstestsuite/library/case.py b/pmstestsuite/library/case.py |
16 |
index a5817fb..614a500 100644 |
17 |
--- a/pmstestsuite/library/case.py |
18 |
+++ b/pmstestsuite/library/case.py |
19 |
@@ -1,5 +1,5 @@ |
20 |
# vim:fileencoding=utf-8 |
21 |
-# (c) 2011 Michał Górny <mgorny@g.o> |
22 |
+# (c) 2011-2012 Michał Górny <mgorny@g.o> |
23 |
# Released under the terms of the 2-clause BSD license. |
24 |
|
25 |
import copy, itertools, random, re |
26 |
@@ -227,7 +227,7 @@ class NotEqualAssertionResult(EqualAssertionResult): |
27 |
return '%s != %s' % (self.actual, |
28 |
repr(self._expect)) |
29 |
|
30 |
-class TestCase(ABCObject): |
31 |
+class TestCase(object): # was: ABCObject |
32 |
""" |
33 |
Base class for a test case. |
34 |
|
35 |
|
36 |
diff --git a/pmstestsuite/library/standard/dbus_case.py b/pmstestsuite/library/standard/dbus_case.py |
37 |
index 672ace5..ac9c4d1 100644 |
38 |
--- a/pmstestsuite/library/standard/dbus_case.py |
39 |
+++ b/pmstestsuite/library/standard/dbus_case.py |
40 |
@@ -1,5 +1,5 @@ |
41 |
# vim:fileencoding=utf-8 |
42 |
-# (c) 2011 Michał Górny <mgorny@g.o> |
43 |
+# (c) 2011-2012 Michał Górny <mgorny@g.o> |
44 |
# Released under the terms of the 2-clause BSD license. |
45 |
|
46 |
import dbus.service |
47 |
@@ -13,30 +13,26 @@ from pmstestsuite.dbus_handler import DBusHandler, dbus_interface_name, dbus_obj |
48 |
|
49 |
dbus_handler = DBusHandler() |
50 |
|
51 |
-class RunningTest(dbus.service.Object): |
52 |
- """ A class encapsulating a running test. """ |
53 |
+class DBusBaseTestCase(dbus.service.Object): |
54 |
+ """ A base D-Bus test case class. """ |
55 |
|
56 |
- def __init__(self, test): |
57 |
+ def __init__(self): |
58 |
""" |
59 |
- Initialize the D-Bus object for the test. |
60 |
- |
61 |
- @param test: the test |
62 |
- @type test: L{TestCase} |
63 |
+ Initialize the D-Bus interface for the test. |
64 |
""" |
65 |
- self.test = test |
66 |
self.reset() |
67 |
dbus.service.Object.__init__( |
68 |
self, |
69 |
dbus_handler.bus, |
70 |
- '%s/%s' % (dbus_object_prefix, test.p.replace('-', '_')) |
71 |
+ '%s/%s' % (dbus_object_prefix, self.p.replace('-', '_')) |
72 |
) |
73 |
|
74 |
def reset(self): |
75 |
""" |
76 |
Reset test results. |
77 |
""" |
78 |
- self.test.dbus_output = [] |
79 |
- self.test.dbus_started = False |
80 |
+ self.dbus_output = [] |
81 |
+ self.dbus_started = False |
82 |
|
83 |
@dbus.service.method( |
84 |
dbus_interface=dbus_interface_name, |
85 |
@@ -45,7 +41,7 @@ class RunningTest(dbus.service.Object): |
86 |
""" |
87 |
Notify the test suite that a particular test has been started. |
88 |
""" |
89 |
- self.test.dbus_started = True |
90 |
+ self.dbus_started = True |
91 |
|
92 |
@dbus.service.method( |
93 |
dbus_interface=dbus_interface_name, |
94 |
@@ -57,13 +53,7 @@ class RunningTest(dbus.service.Object): |
95 |
@param l: result string |
96 |
@type l: C{dbus.UTF8String} |
97 |
""" |
98 |
- self.test.dbus_output.append(str(l)) |
99 |
- |
100 |
-class DBusBaseTestCase(object): |
101 |
- """ A base D-Bus test case class. """ |
102 |
- |
103 |
- def __init__(self): |
104 |
- self._dbusobj = RunningTest(self) |
105 |
+ self.dbus_output.append(str(l)) |
106 |
|
107 |
def _finalize(self): |
108 |
""" |
109 |
@@ -92,7 +82,7 @@ class DBusBaseTestCase(object): |
110 |
|
111 |
def _pop_dbus_output(self): |
112 |
ret = self.dbus_output |
113 |
- self._dbusobj.reset() |
114 |
+ self.reset() |
115 |
return ret |
116 |
|
117 |
def check_result(self, pm): |