Merge lp:~mandel/ubuntuone-client/fix-tests into lp:ubuntuone-client
- fix-tests
- Merge into trunk
Proposed by
Manuel de la Peña
Status: | Merged |
---|---|
Approved by: | Tim Cole |
Approved revision: | 1152 |
Merged at revision: | 1152 |
Proposed branch: | lp:~mandel/ubuntuone-client/fix-tests |
Merge into: | lp:ubuntuone-client |
Diff against target: |
679 lines (+116/-20) 13 files modified
tests/platform/linux/eventlog/test_zglog.py (+4/-3) tests/platform/linux/test_dbus.py (+2/-1) tests/platform/linux/test_messaging.py (+5/-0) tests/platform/linux/test_notification.py (+5/-0) tests/platform/linux/test_unity.py (+3/-0) tests/platform/linux/test_vm.py (+6/-2) tests/platform/test_interaction_interfaces.py (+18/-8) tests/status/test_aggregator.py (+18/-0) tests/syncdaemon/test_action_queue.py (+18/-0) tests/syncdaemon/test_logger.py (+11/-0) tests/syncdaemon/test_pathlockingtree.py (+8/-0) tests/syncdaemon/test_states.py (+16/-5) tests/syncdaemon/test_status_listener.py (+2/-1) |
To merge this branch: | bzr merge lp:~mandel/ubuntuone-client/fix-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Diego Sarmentero (community) | Approve | ||
Tim Cole (community) | Approve | ||
Review via email:
|
Commit message
Use setUp and tearDown correctly with twisted.trial.
Description of the change
Use setUp and tearDown correctly with twisted.trial.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'tests/platform/linux/eventlog/test_zglog.py' | |||
2 | --- tests/platform/linux/eventlog/test_zglog.py 2011-06-15 21:14:06 +0000 | |||
3 | +++ tests/platform/linux/eventlog/test_zglog.py 2011-10-27 11:43:24 +0000 | |||
4 | @@ -25,7 +25,7 @@ | |||
5 | 25 | 25 | ||
6 | 26 | from distutils.spawn import find_executable | 26 | from distutils.spawn import find_executable |
7 | 27 | 27 | ||
9 | 28 | from twisted.internet.defer import Deferred | 28 | from twisted.internet import defer |
10 | 29 | from zeitgeist.client import ZeitgeistClient | 29 | from zeitgeist.client import ZeitgeistClient |
11 | 30 | from zeitgeist.datamodel import Event, Subject, Interpretation, Manifestation | 30 | from zeitgeist.datamodel import Event, Subject, Interpretation, Manifestation |
12 | 31 | 31 | ||
13 | @@ -92,8 +92,9 @@ | |||
14 | 92 | class ZeitgeistTestCase(DBusTwistedTestCase): | 92 | class ZeitgeistTestCase(DBusTwistedTestCase): |
15 | 93 | """Tests for the zeitgeist logging module.""" | 93 | """Tests for the zeitgeist logging module.""" |
16 | 94 | 94 | ||
17 | 95 | @defer.inlineCallbacks | ||
18 | 95 | def setUp(self): | 96 | def setUp(self): |
20 | 96 | super(ZeitgeistTestCase, self).setUp() | 97 | yield super(ZeitgeistTestCase, self).setUp() |
21 | 97 | zgdaemon = find_executable("zeitgeist-daemon") | 98 | zgdaemon = find_executable("zeitgeist-daemon") |
22 | 98 | if not zgdaemon: | 99 | if not zgdaemon: |
23 | 99 | raise NotFoundError("zeitgeist-daemon was not found.") | 100 | raise NotFoundError("zeitgeist-daemon was not found.") |
24 | @@ -138,7 +139,7 @@ | |||
25 | 138 | zg = ZeitgeistLogger() | 139 | zg = ZeitgeistLogger() |
26 | 139 | self.assertNotEqual(zg.client, None) | 140 | self.assertNotEqual(zg.client, None) |
27 | 140 | 141 | ||
29 | 141 | d2 = Deferred() | 142 | d2 = defer.Deferred() |
30 | 142 | 143 | ||
31 | 143 | def logged(id_list): | 144 | def logged(id_list): |
32 | 144 | """The event was logged to zeitgeist.""" | 145 | """The event was logged to zeitgeist.""" |
33 | 145 | 146 | ||
34 | === modified file 'tests/platform/linux/test_dbus.py' | |||
35 | --- tests/platform/linux/test_dbus.py 2011-08-03 20:20:02 +0000 | |||
36 | +++ tests/platform/linux/test_dbus.py 2011-10-27 11:43:24 +0000 | |||
37 | @@ -2909,9 +2909,10 @@ | |||
38 | 2909 | self._old_home = os.environ['HOME'] | 2909 | self._old_home = os.environ['HOME'] |
39 | 2910 | os.environ['HOME'] = self.home_dir | 2910 | os.environ['HOME'] = self.home_dir |
40 | 2911 | 2911 | ||
41 | 2912 | @defer.inlineCallbacks | ||
42 | 2912 | def tearDown(self): | 2913 | def tearDown(self): |
43 | 2913 | os.environ['HOME'] = self._old_home | 2914 | os.environ['HOME'] = self._old_home |
45 | 2914 | return DBusTwistedTestCase.tearDown(self) | 2915 | yield super(FolderTests, self).tearDown() |
46 | 2915 | 2916 | ||
47 | 2916 | def _create_udf(self, id, node_id, suggested_path, subscribed=True): | 2917 | def _create_udf(self, id, node_id, suggested_path, subscribed=True): |
48 | 2917 | """Create an UDF and returns it and the volume.""" | 2918 | """Create an UDF and returns it and the volume.""" |
49 | 2918 | 2919 | ||
50 | === modified file 'tests/platform/linux/test_messaging.py' | |||
51 | --- tests/platform/linux/test_messaging.py 2011-03-29 22:47:53 +0000 | |||
52 | +++ tests/platform/linux/test_messaging.py 2011-10-27 11:43:24 +0000 | |||
53 | @@ -23,6 +23,7 @@ | |||
54 | 23 | 23 | ||
55 | 24 | 24 | ||
56 | 25 | from mocker import Mocker, ANY | 25 | from mocker import Mocker, ANY |
57 | 26 | from twisted.internet import defer | ||
58 | 26 | from twisted.trial.unittest import TestCase | 27 | from twisted.trial.unittest import TestCase |
59 | 27 | 28 | ||
60 | 28 | from ubuntuone.platform.linux.messaging import Messaging, _server_callback | 29 | from ubuntuone.platform.linux.messaging import Messaging, _server_callback |
61 | @@ -42,10 +43,14 @@ | |||
62 | 42 | class MessagingTestCase(TestCase): | 43 | class MessagingTestCase(TestCase): |
63 | 43 | """Test the Messaging API.""" | 44 | """Test the Messaging API.""" |
64 | 44 | 45 | ||
65 | 46 | @defer.inlineCallbacks | ||
66 | 45 | def setUp(self): | 47 | def setUp(self): |
67 | 48 | yield super(MessagingTestCase, self).setUp() | ||
68 | 46 | self.mocker = Mocker() | 49 | self.mocker = Mocker() |
69 | 47 | 50 | ||
70 | 51 | @defer.inlineCallbacks | ||
71 | 48 | def tearDown(self): | 52 | def tearDown(self): |
72 | 53 | yield super(MessagingTestCase, self).tearDown() | ||
73 | 49 | self.mocker.restore() | 54 | self.mocker.restore() |
74 | 50 | self.mocker.verify() | 55 | self.mocker.verify() |
75 | 51 | 56 | ||
76 | 52 | 57 | ||
77 | === modified file 'tests/platform/linux/test_notification.py' | |||
78 | --- tests/platform/linux/test_notification.py 2011-03-03 23:29:37 +0000 | |||
79 | +++ tests/platform/linux/test_notification.py 2011-10-27 11:43:24 +0000 | |||
80 | @@ -23,6 +23,7 @@ | |||
81 | 23 | 23 | ||
82 | 24 | 24 | ||
83 | 25 | from mocker import Mocker | 25 | from mocker import Mocker |
84 | 26 | from twisted.internet import defer | ||
85 | 26 | from twisted.trial.unittest import TestCase | 27 | from twisted.trial.unittest import TestCase |
86 | 27 | 28 | ||
87 | 28 | from ubuntuone.platform.linux.notification import Notification, ICON_NAME | 29 | from ubuntuone.platform.linux.notification import Notification, ICON_NAME |
88 | @@ -45,10 +46,14 @@ | |||
89 | 45 | class NotificationTestCase(TestCase): | 46 | class NotificationTestCase(TestCase): |
90 | 46 | """Test the Messaging API.""" | 47 | """Test the Messaging API.""" |
91 | 47 | 48 | ||
92 | 49 | @defer.inlineCallbacks | ||
93 | 48 | def setUp(self): | 50 | def setUp(self): |
94 | 51 | yield super(NotificationTestCase, self).setUp() | ||
95 | 49 | self.mocker = Mocker() | 52 | self.mocker = Mocker() |
96 | 50 | 53 | ||
97 | 54 | @defer.inlineCallbacks | ||
98 | 51 | def tearDown(self): | 55 | def tearDown(self): |
99 | 56 | yield super(NotificationTestCase, self).tearDown() | ||
100 | 52 | self.mocker.restore() | 57 | self.mocker.restore() |
101 | 53 | self.mocker.verify() | 58 | self.mocker.verify() |
102 | 54 | 59 | ||
103 | 55 | 60 | ||
104 | === modified file 'tests/platform/linux/test_unity.py' | |||
105 | --- tests/platform/linux/test_unity.py 2011-07-06 20:41:33 +0000 | |||
106 | +++ tests/platform/linux/test_unity.py 2011-10-27 11:43:24 +0000 | |||
107 | @@ -18,6 +18,7 @@ | |||
108 | 18 | 18 | ||
109 | 19 | """Tests for the liblauncher interface.""" | 19 | """Tests for the liblauncher interface.""" |
110 | 20 | 20 | ||
111 | 21 | from twisted.internet import defer | ||
112 | 21 | from twisted.trial.unittest import TestCase | 22 | from twisted.trial.unittest import TestCase |
113 | 22 | 23 | ||
114 | 23 | from ubuntuone.platform.linux import launcher | 24 | from ubuntuone.platform.linux import launcher |
115 | @@ -55,8 +56,10 @@ | |||
116 | 55 | 56 | ||
117 | 56 | skip = None if launcher.use_libunity else "libunity not installed." | 57 | skip = None if launcher.use_libunity else "libunity not installed." |
118 | 57 | 58 | ||
119 | 59 | @defer.inlineCallbacks | ||
120 | 58 | def setUp(self): | 60 | def setUp(self): |
121 | 59 | """Initialize this test instance.""" | 61 | """Initialize this test instance.""" |
122 | 62 | yield super(LauncherTestCase, self).setUp() | ||
123 | 60 | self.patch(launcher.Unity, "LauncherEntry", FakeLauncherEntry) | 63 | self.patch(launcher.Unity, "LauncherEntry", FakeLauncherEntry) |
124 | 61 | self.launcher = launcher.UbuntuOneLauncher() | 64 | self.launcher = launcher.UbuntuOneLauncher() |
125 | 62 | 65 | ||
126 | 63 | 66 | ||
127 | === modified file 'tests/platform/linux/test_vm.py' | |||
128 | --- tests/platform/linux/test_vm.py 2011-07-27 20:10:33 +0000 | |||
129 | +++ tests/platform/linux/test_vm.py 2011-10-27 11:43:24 +0000 | |||
130 | @@ -19,6 +19,8 @@ | |||
131 | 19 | import os | 19 | import os |
132 | 20 | import uuid | 20 | import uuid |
133 | 21 | 21 | ||
134 | 22 | from twisted.internet import defer | ||
135 | 23 | |||
136 | 22 | from contrib.testing.testcase import FakeMain, environ | 24 | from contrib.testing.testcase import FakeMain, environ |
137 | 23 | from tests.syncdaemon.test_vm import MetadataTestCase, BaseVolumeManagerTests | 25 | from tests.syncdaemon.test_vm import MetadataTestCase, BaseVolumeManagerTests |
138 | 24 | from ubuntuone.storageprotocol import request | 26 | from ubuntuone.storageprotocol import request |
139 | @@ -44,8 +46,9 @@ | |||
140 | 44 | class MetadataOldLayoutTests(MetadataTestCase): | 46 | class MetadataOldLayoutTests(MetadataTestCase): |
141 | 45 | """Tests for 'old' layouts and metadata upgrade""" | 47 | """Tests for 'old' layouts and metadata upgrade""" |
142 | 46 | 48 | ||
143 | 49 | @defer.inlineCallbacks | ||
144 | 47 | def setUp(self): | 50 | def setUp(self): |
146 | 48 | MetadataTestCase.setUp(self) | 51 | yield super(MetadataOldLayoutTests, self).setUp() |
147 | 49 | self.root_dir = os.path.join(self.u1_dir, 'My Files') | 52 | self.root_dir = os.path.join(self.u1_dir, 'My Files') |
148 | 50 | self.shares_dir = os.path.join(self.u1_dir, 'Shared With Me') | 53 | self.shares_dir = os.path.join(self.u1_dir, 'Shared With Me') |
149 | 51 | self.new_root_dir = self.u1_dir | 54 | self.new_root_dir = self.u1_dir |
150 | @@ -451,8 +454,9 @@ | |||
151 | 451 | class MetadataNewLayoutTests(MetadataTestCase): | 454 | class MetadataNewLayoutTests(MetadataTestCase): |
152 | 452 | """Test for 'new' layout and metadata upgrade.""" | 455 | """Test for 'new' layout and metadata upgrade.""" |
153 | 453 | 456 | ||
154 | 457 | @defer.inlineCallbacks | ||
155 | 454 | def setUp(self): | 458 | def setUp(self): |
157 | 455 | MetadataTestCase.setUp(self) | 459 | yield super(MetadataNewLayoutTests, self).setUp() |
158 | 456 | self.share_md_dir = os.path.join(self.vm_data_dir, 'shares') | 460 | self.share_md_dir = os.path.join(self.vm_data_dir, 'shares') |
159 | 457 | self.shared_md_dir = os.path.join(self.vm_data_dir, 'shared') | 461 | self.shared_md_dir = os.path.join(self.vm_data_dir, 'shared') |
160 | 458 | self.home_dir = os.path.join(self.tmpdir, 'home', 'ubuntuonehacker') | 462 | self.home_dir = os.path.join(self.tmpdir, 'home', 'ubuntuonehacker') |
161 | 459 | 463 | ||
162 | === modified file 'tests/platform/test_interaction_interfaces.py' | |||
163 | --- tests/platform/test_interaction_interfaces.py 2011-07-27 14:26:36 +0000 | |||
164 | +++ tests/platform/test_interaction_interfaces.py 2011-10-27 11:43:24 +0000 | |||
165 | @@ -18,15 +18,18 @@ | |||
166 | 18 | """Test that the interaction_interfaces are correctly called.""" | 18 | """Test that the interaction_interfaces are correctly called.""" |
167 | 19 | 19 | ||
168 | 20 | from mocker import MockerTestCase, MATCH | 20 | from mocker import MockerTestCase, MATCH |
169 | 21 | from twisted.internet import defer | ||
170 | 22 | |||
171 | 21 | from tests.platform import IPCTestCase | 23 | from tests.platform import IPCTestCase |
172 | 22 | 24 | ||
173 | 23 | 25 | ||
174 | 24 | class TestStatusIPC(MockerTestCase, IPCTestCase): | 26 | class TestStatusIPC(MockerTestCase, IPCTestCase): |
175 | 25 | """Ensure that calls are correctly fowarded.""" | 27 | """Ensure that calls are correctly fowarded.""" |
176 | 26 | 28 | ||
177 | 29 | @defer.inlineCallbacks | ||
178 | 27 | def setUp(self): | 30 | def setUp(self): |
179 | 28 | """Set up tests.""" | 31 | """Set up tests.""" |
181 | 29 | super(TestStatusIPC, self).setUp() | 32 | yield super(TestStatusIPC, self).setUp() |
182 | 30 | self.syncdaemon_status = self.mocker.mock() | 33 | self.syncdaemon_status = self.mocker.mock() |
183 | 31 | self.status.syncdaemon_status = self.syncdaemon_status | 34 | self.status.syncdaemon_status = self.syncdaemon_status |
184 | 32 | 35 | ||
185 | @@ -82,9 +85,10 @@ | |||
186 | 82 | class TestEventsIPC(MockerTestCase, IPCTestCase): | 85 | class TestEventsIPC(MockerTestCase, IPCTestCase): |
187 | 83 | """Ensure that calls are correctly fowarded.""" | 86 | """Ensure that calls are correctly fowarded.""" |
188 | 84 | 87 | ||
189 | 88 | @defer.inlineCallbacks | ||
190 | 85 | def setUp(self): | 89 | def setUp(self): |
191 | 86 | """Set up tests.""" | 90 | """Set up tests.""" |
193 | 87 | super(TestEventsIPC, self).setUp() | 91 | yield super(TestEventsIPC, self).setUp() |
194 | 88 | self.events_mock = self.mocker.mock() | 92 | self.events_mock = self.mocker.mock() |
195 | 89 | self.events.events = self.events_mock | 93 | self.events.events = self.events_mock |
196 | 90 | 94 | ||
197 | @@ -100,9 +104,10 @@ | |||
198 | 100 | class TestSyncDaemonIPC(MockerTestCase, IPCTestCase): | 104 | class TestSyncDaemonIPC(MockerTestCase, IPCTestCase): |
199 | 101 | """Ensure that calls are correctly fowarded.""" | 105 | """Ensure that calls are correctly fowarded.""" |
200 | 102 | 106 | ||
201 | 107 | @defer.inlineCallbacks | ||
202 | 103 | def setUp(self): | 108 | def setUp(self): |
203 | 104 | """Set up tests.""" | 109 | """Set up tests.""" |
205 | 105 | super(TestSyncDaemonIPC, self).setUp() | 110 | yield super(TestSyncDaemonIPC, self).setUp() |
206 | 106 | self.service = self.mocker.mock() | 111 | self.service = self.mocker.mock() |
207 | 107 | self.sync.service = self.service | 112 | self.sync.service = self.service |
208 | 108 | 113 | ||
209 | @@ -174,9 +179,10 @@ | |||
210 | 174 | class TestFileSystemIPC(MockerTestCase, IPCTestCase): | 179 | class TestFileSystemIPC(MockerTestCase, IPCTestCase): |
211 | 175 | """Ensure that calls are correctly fowarded.""" | 180 | """Ensure that calls are correctly fowarded.""" |
212 | 176 | 181 | ||
213 | 182 | @defer.inlineCallbacks | ||
214 | 177 | def setUp(self): | 183 | def setUp(self): |
215 | 178 | """Set up tests.""" | 184 | """Set up tests.""" |
217 | 179 | super(TestFileSystemIPC, self).setUp() | 185 | yield super(TestFileSystemIPC, self).setUp() |
218 | 180 | self.syncdaemon_filesystem = self.mocker.mock() | 186 | self.syncdaemon_filesystem = self.mocker.mock() |
219 | 181 | self.fs.syncdaemon_filesystem = self.syncdaemon_filesystem | 187 | self.fs.syncdaemon_filesystem = self.syncdaemon_filesystem |
220 | 182 | 188 | ||
221 | @@ -221,9 +227,10 @@ | |||
222 | 221 | class TestSharesIPC(MockerTestCase, IPCTestCase): | 227 | class TestSharesIPC(MockerTestCase, IPCTestCase): |
223 | 222 | """Ensure that calls are correctly fowarded.""" | 228 | """Ensure that calls are correctly fowarded.""" |
224 | 223 | 229 | ||
225 | 230 | @defer.inlineCallbacks | ||
226 | 224 | def setUp(self): | 231 | def setUp(self): |
227 | 225 | """Set up tests.""" | 232 | """Set up tests.""" |
229 | 226 | super(TestSharesIPC, self).setUp() | 233 | yield super(TestSharesIPC, self).setUp() |
230 | 227 | self.syncdaemon_shares = self.mocker.mock() | 234 | self.syncdaemon_shares = self.mocker.mock() |
231 | 228 | self.shares.syncdaemon_shares = self.syncdaemon_shares | 235 | self.shares.syncdaemon_shares = self.syncdaemon_shares |
232 | 229 | 236 | ||
233 | @@ -316,9 +323,10 @@ | |||
234 | 316 | class TestConfigIPC(MockerTestCase, IPCTestCase): | 323 | class TestConfigIPC(MockerTestCase, IPCTestCase): |
235 | 317 | """Ensure that calls are correctly fowarded.""" | 324 | """Ensure that calls are correctly fowarded.""" |
236 | 318 | 325 | ||
237 | 326 | @defer.inlineCallbacks | ||
238 | 319 | def setUp(self): | 327 | def setUp(self): |
239 | 320 | """Set up tests.""" | 328 | """Set up tests.""" |
241 | 321 | super(TestConfigIPC, self).setUp() | 329 | yield super(TestConfigIPC, self).setUp() |
242 | 322 | self.syncdaemon_config = self.mocker.mock() | 330 | self.syncdaemon_config = self.mocker.mock() |
243 | 323 | self.config.syncdaemon_config = self.syncdaemon_config | 331 | self.config.syncdaemon_config = self.syncdaemon_config |
244 | 324 | 332 | ||
245 | @@ -467,9 +475,10 @@ | |||
246 | 467 | class TestFoldersIPC(MockerTestCase, IPCTestCase): | 475 | class TestFoldersIPC(MockerTestCase, IPCTestCase): |
247 | 468 | """Ensure that calls are correctly fowarded.""" | 476 | """Ensure that calls are correctly fowarded.""" |
248 | 469 | 477 | ||
249 | 478 | @defer.inlineCallbacks | ||
250 | 470 | def setUp(self): | 479 | def setUp(self): |
251 | 471 | """Set up tests.""" | 480 | """Set up tests.""" |
253 | 472 | super(TestFoldersIPC, self).setUp() | 481 | yield super(TestFoldersIPC, self).setUp() |
254 | 473 | self.syncdaemon_folders = self.mocker.mock() | 482 | self.syncdaemon_folders = self.mocker.mock() |
255 | 474 | self.folders.syncdaemon_folders = self.syncdaemon_folders | 483 | self.folders.syncdaemon_folders = self.syncdaemon_folders |
256 | 475 | 484 | ||
257 | @@ -528,9 +537,10 @@ | |||
258 | 528 | class TestPublicFilesIPC(MockerTestCase, IPCTestCase): | 537 | class TestPublicFilesIPC(MockerTestCase, IPCTestCase): |
259 | 529 | """Ensure that calls are correctly fowarded.""" | 538 | """Ensure that calls are correctly fowarded.""" |
260 | 530 | 539 | ||
261 | 540 | @defer.inlineCallbacks | ||
262 | 531 | def setUp(self): | 541 | def setUp(self): |
263 | 532 | """Set up tests.""" | 542 | """Set up tests.""" |
265 | 533 | super(TestPublicFilesIPC, self).setUp() | 543 | yield super(TestPublicFilesIPC, self).setUp() |
266 | 534 | self.syncdaemon_public_files = self.mocker.mock() | 544 | self.syncdaemon_public_files = self.mocker.mock() |
267 | 535 | self.public_files.syncdaemon_public_files =\ | 545 | self.public_files.syncdaemon_public_files =\ |
268 | 536 | self.syncdaemon_public_files | 546 | self.syncdaemon_public_files |
269 | 537 | 547 | ||
270 | === modified file 'tests/status/test_aggregator.py' | |||
271 | --- tests/status/test_aggregator.py 2011-09-21 14:12:25 +0000 | |||
272 | +++ tests/status/test_aggregator.py 2011-10-27 11:43:24 +0000 | |||
273 | @@ -50,8 +50,10 @@ | |||
274 | 50 | 50 | ||
275 | 51 | TIMEOUT = 3.0 | 51 | TIMEOUT = 3.0 |
276 | 52 | 52 | ||
277 | 53 | @defer.inlineCallbacks | ||
278 | 53 | def setUp(self): | 54 | def setUp(self): |
279 | 54 | """Initialize this test instance.""" | 55 | """Initialize this test instance.""" |
280 | 56 | yield super(TimerTestCase, self).setUp() | ||
281 | 55 | self.clock = PatchedClock() | 57 | self.clock = PatchedClock() |
282 | 56 | self.timer = aggregator.Timer(delay=3.0, clock=self.clock) | 58 | self.timer = aggregator.Timer(delay=3.0, clock=self.clock) |
283 | 57 | 59 | ||
284 | @@ -101,8 +103,10 @@ | |||
285 | 101 | 103 | ||
286 | 102 | DELAY = 0.5 | 104 | DELAY = 0.5 |
287 | 103 | 105 | ||
288 | 106 | @defer.inlineCallbacks | ||
289 | 104 | def setUp(self): | 107 | def setUp(self): |
290 | 105 | """Initialize this test instance.""" | 108 | """Initialize this test instance.""" |
291 | 109 | yield super(DeadlineTimerTestCase, self).setUp() | ||
292 | 106 | self.clock = PatchedClock() | 110 | self.clock = PatchedClock() |
293 | 107 | self.timer = aggregator.DeadlineTimer(delay=0.5, timeout=3.0, | 111 | self.timer = aggregator.DeadlineTimer(delay=0.5, timeout=3.0, |
294 | 108 | clock=self.clock) | 112 | clock=self.clock) |
295 | @@ -242,8 +246,10 @@ | |||
296 | 242 | class ToggleableNotificationTestCase(TestCase): | 246 | class ToggleableNotificationTestCase(TestCase): |
297 | 243 | """Test the ToggleableNotification class.""" | 247 | """Test the ToggleableNotification class.""" |
298 | 244 | 248 | ||
299 | 249 | @defer.inlineCallbacks | ||
300 | 245 | def setUp(self): | 250 | def setUp(self): |
301 | 246 | """Initialize this test instance.""" | 251 | """Initialize this test instance.""" |
302 | 252 | yield super(ToggleableNotificationTestCase, self).setUp() | ||
303 | 247 | self.patch(aggregator, "Notification", FakeNotification) | 253 | self.patch(aggregator, "Notification", FakeNotification) |
304 | 248 | self.notification_switch = aggregator.NotificationSwitch() | 254 | self.notification_switch = aggregator.NotificationSwitch() |
305 | 249 | self.toggleable = self.notification_switch.get_notification() | 255 | self.toggleable = self.notification_switch.get_notification() |
306 | @@ -282,8 +288,10 @@ | |||
307 | 282 | class NotificationSwitchTestCase(TestCase): | 288 | class NotificationSwitchTestCase(TestCase): |
308 | 283 | """Test the NotificationSwitch class.""" | 289 | """Test the NotificationSwitch class.""" |
309 | 284 | 290 | ||
310 | 291 | @defer.inlineCallbacks | ||
311 | 285 | def setUp(self): | 292 | def setUp(self): |
312 | 286 | """Initialize this test instance.""" | 293 | """Initialize this test instance.""" |
313 | 294 | yield super(NotificationSwitchTestCase, self).setUp() | ||
314 | 287 | self.notification_switch = aggregator.NotificationSwitch() | 295 | self.notification_switch = aggregator.NotificationSwitch() |
315 | 288 | 296 | ||
316 | 289 | def test_get_notification(self): | 297 | def test_get_notification(self): |
317 | @@ -306,8 +314,10 @@ | |||
318 | 306 | class FileDiscoveryBubbleTestCase(TestCase): | 314 | class FileDiscoveryBubbleTestCase(TestCase): |
319 | 307 | """Test the FileDiscoveryBubble class.""" | 315 | """Test the FileDiscoveryBubble class.""" |
320 | 308 | 316 | ||
321 | 317 | @defer.inlineCallbacks | ||
322 | 309 | def setUp(self): | 318 | def setUp(self): |
323 | 310 | """Initialize this test instance.""" | 319 | """Initialize this test instance.""" |
324 | 320 | yield super(FileDiscoveryBubbleTestCase, self).setUp() | ||
325 | 311 | self.patch(aggregator, "ToggleableNotification", | 321 | self.patch(aggregator, "ToggleableNotification", |
326 | 312 | FakeNotificationSingleton()) | 322 | FakeNotificationSingleton()) |
327 | 313 | self.clock = PatchedClock() | 323 | self.clock = PatchedClock() |
328 | @@ -487,8 +497,10 @@ | |||
329 | 487 | class FinalBubbleTestCase(TestCase): | 497 | class FinalBubbleTestCase(TestCase): |
330 | 488 | """Test for the final status notification bubble.""" | 498 | """Test for the final status notification bubble.""" |
331 | 489 | 499 | ||
332 | 500 | @defer.inlineCallbacks | ||
333 | 490 | def setUp(self): | 501 | def setUp(self): |
334 | 491 | """Initialize this test instance.""" | 502 | """Initialize this test instance.""" |
335 | 503 | yield super(FinalBubbleTestCase, self).setUp() | ||
336 | 492 | self.patch(aggregator, "ToggleableNotification", | 504 | self.patch(aggregator, "ToggleableNotification", |
337 | 493 | FakeNotificationSingleton()) | 505 | FakeNotificationSingleton()) |
338 | 494 | self.clock = PatchedClock() | 506 | self.clock = PatchedClock() |
339 | @@ -542,8 +554,10 @@ | |||
340 | 542 | class ProgressBarTestCase(TestCase): | 554 | class ProgressBarTestCase(TestCase): |
341 | 543 | """Tests for the progress bar.""" | 555 | """Tests for the progress bar.""" |
342 | 544 | 556 | ||
343 | 557 | @defer.inlineCallbacks | ||
344 | 545 | def setUp(self): | 558 | def setUp(self): |
345 | 546 | """Initialize this test instance.""" | 559 | """Initialize this test instance.""" |
346 | 560 | yield super(ProgressBarTestCase, self).setUp() | ||
347 | 547 | self.patch(aggregator, "UbuntuOneLauncher", FakeLauncher) | 561 | self.patch(aggregator, "UbuntuOneLauncher", FakeLauncher) |
348 | 548 | self.patch(aggregator.session, "Inhibitor", FakeInhibitor) | 562 | self.patch(aggregator.session, "Inhibitor", FakeInhibitor) |
349 | 549 | self.clock = PatchedClock() | 563 | self.clock = PatchedClock() |
350 | @@ -1035,8 +1049,10 @@ | |||
351 | 1035 | CLASS_KWARGS = {} | 1049 | CLASS_KWARGS = {} |
352 | 1036 | status = None | 1050 | status = None |
353 | 1037 | 1051 | ||
354 | 1052 | @defer.inlineCallbacks | ||
355 | 1038 | def setUp(self): | 1053 | def setUp(self): |
356 | 1039 | """Initialize this test instance.""" | 1054 | """Initialize this test instance.""" |
357 | 1055 | yield super(StatusEventTestCase, self).setUp() | ||
358 | 1040 | if type(self) == StatusEventTestCase: | 1056 | if type(self) == StatusEventTestCase: |
359 | 1041 | self.assertRaises(AssertionError, self.CLASS, **self.CLASS_KWARGS) | 1057 | self.assertRaises(AssertionError, self.CLASS, **self.CLASS_KWARGS) |
360 | 1042 | else: | 1058 | else: |
361 | @@ -1179,8 +1195,10 @@ | |||
362 | 1179 | class StatusAggregatorTestCase(TestCase): | 1195 | class StatusAggregatorTestCase(TestCase): |
363 | 1180 | """Test the backend of the status aggregator.""" | 1196 | """Test the backend of the status aggregator.""" |
364 | 1181 | 1197 | ||
365 | 1198 | @defer.inlineCallbacks | ||
366 | 1182 | def setUp(self): | 1199 | def setUp(self): |
367 | 1183 | """Initialize this test instance.""" | 1200 | """Initialize this test instance.""" |
368 | 1201 | yield super(StatusAggregatorTestCase, self).setUp() | ||
369 | 1184 | self.patch(aggregator, "FileDiscoveryBubble", | 1202 | self.patch(aggregator, "FileDiscoveryBubble", |
370 | 1185 | FakeFileDiscoveryBubble) | 1203 | FakeFileDiscoveryBubble) |
371 | 1186 | self.patch(aggregator, "FinalStatusBubble", | 1204 | self.patch(aggregator, "FinalStatusBubble", |
372 | 1187 | 1205 | ||
373 | === modified file 'tests/syncdaemon/test_action_queue.py' | |||
374 | --- tests/syncdaemon/test_action_queue.py 2011-10-06 20:40:06 +0000 | |||
375 | +++ tests/syncdaemon/test_action_queue.py 2011-10-27 11:43:24 +0000 | |||
376 | @@ -283,6 +283,7 @@ | |||
377 | 283 | @defer.inlineCallbacks | 283 | @defer.inlineCallbacks |
378 | 284 | def tearDown(self): | 284 | def tearDown(self): |
379 | 285 | """Cleanup.""" | 285 | """Cleanup.""" |
380 | 286 | yield super(BasicTestCase, self).tearDown() | ||
381 | 286 | for record in self.handler.records: | 287 | for record in self.handler.records: |
382 | 287 | exc_info = getattr(record, 'exc_info', None) | 288 | exc_info = getattr(record, 'exc_info', None) |
383 | 288 | if exc_info is not None: | 289 | if exc_info is not None: |
384 | @@ -442,8 +443,10 @@ | |||
385 | 442 | class TestRequestQueue(TwistedTestCase): | 443 | class TestRequestQueue(TwistedTestCase): |
386 | 443 | """Tests for the RequestQueue.""" | 444 | """Tests for the RequestQueue.""" |
387 | 444 | 445 | ||
388 | 446 | @defer.inlineCallbacks | ||
389 | 445 | def setUp(self): | 447 | def setUp(self): |
390 | 446 | """Set up.""" | 448 | """Set up.""" |
391 | 449 | yield super(TestRequestQueue, self).setUp() | ||
392 | 447 | 450 | ||
393 | 448 | class FakeAQ(object): | 451 | class FakeAQ(object): |
394 | 449 | """Fake AQ.""" | 452 | """Fake AQ.""" |
395 | @@ -765,8 +768,10 @@ | |||
396 | 765 | class TestDeferredMap(TwistedTestCase): | 768 | class TestDeferredMap(TwistedTestCase): |
397 | 766 | """Test the deferred map.""" | 769 | """Test the deferred map.""" |
398 | 767 | 770 | ||
399 | 771 | @defer.inlineCallbacks | ||
400 | 768 | def setUp(self): | 772 | def setUp(self): |
401 | 769 | """Set up.""" | 773 | """Set up.""" |
402 | 774 | yield super(TestDeferredMap, self).setUp() | ||
403 | 770 | self.dm = DeferredMap() | 775 | self.dm = DeferredMap() |
404 | 771 | 776 | ||
405 | 772 | def test_one_get_returns_stored_deferred(self): | 777 | def test_one_get_returns_stored_deferred(self): |
406 | @@ -853,8 +858,10 @@ | |||
407 | 853 | class TestZipQueue(TwistedTestCase): | 858 | class TestZipQueue(TwistedTestCase): |
408 | 854 | """Test the zipping queue.""" | 859 | """Test the zipping queue.""" |
409 | 855 | 860 | ||
410 | 861 | @defer.inlineCallbacks | ||
411 | 856 | def setUp(self): | 862 | def setUp(self): |
412 | 857 | """Set up.""" | 863 | """Set up.""" |
413 | 864 | yield super(TestZipQueue, self).setUp() | ||
414 | 858 | self.zq = ZipQueue() | 865 | self.zq = ZipQueue() |
415 | 859 | 866 | ||
416 | 860 | @defer.inlineCallbacks | 867 | @defer.inlineCallbacks |
417 | @@ -5007,8 +5014,10 @@ | |||
418 | 5007 | class ActionQueueProtocolTests(TwistedTestCase): | 5014 | class ActionQueueProtocolTests(TwistedTestCase): |
419 | 5008 | """Test the ACQ class.""" | 5015 | """Test the ACQ class.""" |
420 | 5009 | 5016 | ||
421 | 5017 | @defer.inlineCallbacks | ||
422 | 5010 | def setUp(self): | 5018 | def setUp(self): |
423 | 5011 | """Set up.""" | 5019 | """Set up.""" |
424 | 5020 | yield super(ActionQueueProtocolTests, self).setUp() | ||
425 | 5012 | # create an AQP and put a factory to it | 5021 | # create an AQP and put a factory to it |
426 | 5013 | self.aqp = ActionQueueProtocol() | 5022 | self.aqp = ActionQueueProtocol() |
427 | 5014 | obj = Mocker().mock() | 5023 | obj = Mocker().mock() |
428 | @@ -5020,8 +5029,10 @@ | |||
429 | 5020 | self.handler.setLevel(logging.DEBUG) | 5029 | self.handler.setLevel(logging.DEBUG) |
430 | 5021 | self.aqp.log.addHandler(self.handler) | 5030 | self.aqp.log.addHandler(self.handler) |
431 | 5022 | 5031 | ||
432 | 5032 | @defer.inlineCallbacks | ||
433 | 5023 | def tearDown(self): | 5033 | def tearDown(self): |
434 | 5024 | """Tear down.""" | 5034 | """Tear down.""" |
435 | 5035 | yield super(ActionQueueProtocolTests, self).tearDown() | ||
436 | 5025 | self.aqp.log.removeHandler(self.handler) | 5036 | self.aqp.log.removeHandler(self.handler) |
437 | 5026 | if self.aqp.ping_manager is not None: | 5037 | if self.aqp.ping_manager is not None: |
438 | 5027 | self.aqp.ping_manager.stop() | 5038 | self.aqp.ping_manager.stop() |
439 | @@ -5629,8 +5640,10 @@ | |||
440 | 5629 | class ConditionsLockerTests(TwistedTestCase): | 5640 | class ConditionsLockerTests(TwistedTestCase): |
441 | 5630 | """Test the ConditionsLocker.""" | 5641 | """Test the ConditionsLocker.""" |
442 | 5631 | 5642 | ||
443 | 5643 | @defer.inlineCallbacks | ||
444 | 5632 | def setUp(self): | 5644 | def setUp(self): |
445 | 5633 | """Set up.""" | 5645 | """Set up.""" |
446 | 5646 | yield super(ConditionsLockerTests, self).setUp() | ||
447 | 5634 | self.cl = ConditionsLocker() | 5647 | self.cl = ConditionsLocker() |
448 | 5635 | 5648 | ||
449 | 5636 | def test_get_locking_deferred_returns_deferred(self): | 5649 | def test_get_locking_deferred_returns_deferred(self): |
450 | @@ -5752,8 +5765,11 @@ | |||
451 | 5752 | class PingManagerTestCase(TwistedTestCase): | 5765 | class PingManagerTestCase(TwistedTestCase): |
452 | 5753 | """Test the Ping manager.""" | 5766 | """Test the Ping manager.""" |
453 | 5754 | 5767 | ||
454 | 5768 | @defer.inlineCallbacks | ||
455 | 5755 | def setUp(self): | 5769 | def setUp(self): |
456 | 5756 | """Set up.""" | 5770 | """Set up.""" |
457 | 5771 | yield super(PingManagerTestCase, self).setUp() | ||
458 | 5772 | |||
459 | 5757 | class FakeActionQueueProtocol(object): | 5773 | class FakeActionQueueProtocol(object): |
460 | 5758 | """Fake object for the tests.""" | 5774 | """Fake object for the tests.""" |
461 | 5759 | log = logging.getLogger("ubuntuone.SyncDaemon.ActionQueue") | 5775 | log = logging.getLogger("ubuntuone.SyncDaemon.ActionQueue") |
462 | @@ -5765,8 +5781,10 @@ | |||
463 | 5765 | self.fake_aqp.log.addHandler(self.handler) | 5781 | self.fake_aqp.log.addHandler(self.handler) |
464 | 5766 | self.pm = PingManager(self.fake_aqp) | 5782 | self.pm = PingManager(self.fake_aqp) |
465 | 5767 | 5783 | ||
466 | 5784 | @defer.inlineCallbacks | ||
467 | 5768 | def tearDown(self): | 5785 | def tearDown(self): |
468 | 5769 | """Tear down.""" | 5786 | """Tear down.""" |
469 | 5787 | yield super(PingManagerTestCase, self).tearDown() | ||
470 | 5770 | self.fake_aqp.log.removeHandler(self.handler) | 5788 | self.fake_aqp.log.removeHandler(self.handler) |
471 | 5771 | self.pm.stop() | 5789 | self.pm.stop() |
472 | 5772 | 5790 | ||
473 | 5773 | 5791 | ||
474 | === modified file 'tests/syncdaemon/test_logger.py' | |||
475 | --- tests/syncdaemon/test_logger.py 2011-08-10 12:01:01 +0000 | |||
476 | +++ tests/syncdaemon/test_logger.py 2011-10-27 11:43:24 +0000 | |||
477 | @@ -20,6 +20,7 @@ | |||
478 | 20 | 20 | ||
479 | 21 | import logging | 21 | import logging |
480 | 22 | 22 | ||
481 | 23 | from twisted.internet import defer | ||
482 | 23 | from twisted.trial import unittest | 24 | from twisted.trial import unittest |
483 | 24 | 25 | ||
484 | 25 | from ubuntuone.devtools.handlers import MementoHandler | 26 | from ubuntuone.devtools.handlers import MementoHandler |
485 | @@ -39,15 +40,19 @@ | |||
486 | 39 | class DebugCaptureTest(unittest.TestCase): | 40 | class DebugCaptureTest(unittest.TestCase): |
487 | 40 | """Tests for DebugCapture context manager.""" | 41 | """Tests for DebugCapture context manager.""" |
488 | 41 | 42 | ||
489 | 43 | @defer.inlineCallbacks | ||
490 | 42 | def setUp(self): | 44 | def setUp(self): |
491 | 43 | """Setup the logger and the handler""" | 45 | """Setup the logger and the handler""" |
492 | 46 | yield super(DebugCaptureTest, self).setUp() | ||
493 | 44 | self.handler = MementoHandler() | 47 | self.handler = MementoHandler() |
494 | 45 | self.logger = logging.getLogger(self.__class__.__name__) | 48 | self.logger = logging.getLogger(self.__class__.__name__) |
495 | 46 | self.logger.addHandler(self.handler) | 49 | self.logger.addHandler(self.handler) |
496 | 47 | self.logger.setLevel(logging.DEBUG) | 50 | self.logger.setLevel(logging.DEBUG) |
497 | 48 | 51 | ||
498 | 52 | @defer.inlineCallbacks | ||
499 | 49 | def tearDown(self): | 53 | def tearDown(self): |
500 | 50 | """close the handler and restore the logger (Logger's are global)""" | 54 | """close the handler and restore the logger (Logger's are global)""" |
501 | 55 | yield super(DebugCaptureTest, self).tearDown() | ||
502 | 51 | self.handler.close() | 56 | self.handler.close() |
503 | 52 | self.logger.removeHandler(self.handler) | 57 | self.logger.removeHandler(self.handler) |
504 | 53 | self.logger.setLevel(logging.DEBUG) | 58 | self.logger.setLevel(logging.DEBUG) |
505 | @@ -222,8 +227,10 @@ | |||
506 | 222 | class FilterTests(unittest.TestCase): | 227 | class FilterTests(unittest.TestCase): |
507 | 223 | """Tests log filters""" | 228 | """Tests log filters""" |
508 | 224 | 229 | ||
509 | 230 | @defer.inlineCallbacks | ||
510 | 225 | def setUp(self): | 231 | def setUp(self): |
511 | 226 | """Setup the logger and the handler""" | 232 | """Setup the logger and the handler""" |
512 | 233 | yield super(FilterTests, self).setUp() | ||
513 | 227 | self.handler = MementoHandler() | 234 | self.handler = MementoHandler() |
514 | 228 | self.handler.setLevel(logging.DEBUG) | 235 | self.handler.setLevel(logging.DEBUG) |
515 | 229 | root_logger.addHandler(self.handler) | 236 | root_logger.addHandler(self.handler) |
516 | @@ -253,15 +260,19 @@ | |||
517 | 253 | class MultiFilterTest(unittest.TestCase): | 260 | class MultiFilterTest(unittest.TestCase): |
518 | 254 | """Tests for logger.MultiFilter""" | 261 | """Tests for logger.MultiFilter""" |
519 | 255 | 262 | ||
520 | 263 | @defer.inlineCallbacks | ||
521 | 256 | def setUp(self): | 264 | def setUp(self): |
522 | 257 | """Setup the logger and the handler""" | 265 | """Setup the logger and the handler""" |
523 | 266 | yield super(MultiFilterTest, self).setUp() | ||
524 | 258 | self.handler = MementoHandler() | 267 | self.handler = MementoHandler() |
525 | 259 | self.logger = logging.getLogger(self.__class__.__name__) | 268 | self.logger = logging.getLogger(self.__class__.__name__) |
526 | 260 | self.logger.addHandler(self.handler) | 269 | self.logger.addHandler(self.handler) |
527 | 261 | self.logger.setLevel(logging.DEBUG) | 270 | self.logger.setLevel(logging.DEBUG) |
528 | 262 | 271 | ||
529 | 272 | @defer.inlineCallbacks | ||
530 | 263 | def tearDown(self): | 273 | def tearDown(self): |
531 | 264 | """close the handler and restore the logger (Logger's are global)""" | 274 | """close the handler and restore the logger (Logger's are global)""" |
532 | 275 | yield super(MultiFilterTest, self).tearDown() | ||
533 | 265 | self.handler.close() | 276 | self.handler.close() |
534 | 266 | self.logger.removeHandler(self.handler) | 277 | self.logger.removeHandler(self.handler) |
535 | 267 | self.logger.setLevel(logging.DEBUG) | 278 | self.logger.setLevel(logging.DEBUG) |
536 | 268 | 279 | ||
537 | === modified file 'tests/syncdaemon/test_pathlockingtree.py' | |||
538 | --- tests/syncdaemon/test_pathlockingtree.py 2011-01-20 21:27:24 +0000 | |||
539 | +++ tests/syncdaemon/test_pathlockingtree.py 2011-10-27 11:43:24 +0000 | |||
540 | @@ -29,8 +29,10 @@ | |||
541 | 29 | class InternalDeferredTests(TwistedTestCase): | 29 | class InternalDeferredTests(TwistedTestCase): |
542 | 30 | """Test the internal deferreds handling functionality.""" | 30 | """Test the internal deferreds handling functionality.""" |
543 | 31 | 31 | ||
544 | 32 | @defer.inlineCallbacks | ||
545 | 32 | def setUp(self): | 33 | def setUp(self): |
546 | 33 | """Set up.""" | 34 | """Set up.""" |
547 | 35 | yield super(InternalDeferredTests, self).setUp() | ||
548 | 34 | self.plt = PathLockingTree() | 36 | self.plt = PathLockingTree() |
549 | 35 | 37 | ||
550 | 36 | def test_single_element_old(self): | 38 | def test_single_element_old(self): |
551 | @@ -217,8 +219,10 @@ | |||
552 | 217 | class LockingTests(TwistedTestCase): | 219 | class LockingTests(TwistedTestCase): |
553 | 218 | """Test the locking between elements.""" | 220 | """Test the locking between elements.""" |
554 | 219 | 221 | ||
555 | 222 | @defer.inlineCallbacks | ||
556 | 220 | def setUp(self): | 223 | def setUp(self): |
557 | 221 | """Set up.""" | 224 | """Set up.""" |
558 | 225 | yield super(LockingTests, self).setUp() | ||
559 | 222 | self.plt = PathLockingTree() | 226 | self.plt = PathLockingTree() |
560 | 223 | 227 | ||
561 | 224 | @defer.inlineCallbacks | 228 | @defer.inlineCallbacks |
562 | @@ -417,8 +421,10 @@ | |||
563 | 417 | class CleaningTests(TwistedTestCase): | 421 | class CleaningTests(TwistedTestCase): |
564 | 418 | """Test that the releases clean the tree.""" | 422 | """Test that the releases clean the tree.""" |
565 | 419 | 423 | ||
566 | 424 | @defer.inlineCallbacks | ||
567 | 420 | def setUp(self): | 425 | def setUp(self): |
568 | 421 | """Set up.""" | 426 | """Set up.""" |
569 | 427 | yield super(CleaningTests, self).setUp() | ||
570 | 422 | self.plt = PathLockingTree() | 428 | self.plt = PathLockingTree() |
571 | 423 | 429 | ||
572 | 424 | @defer.inlineCallbacks | 430 | @defer.inlineCallbacks |
573 | @@ -547,8 +553,10 @@ | |||
574 | 547 | class LoggingTests(TwistedTestCase): | 553 | class LoggingTests(TwistedTestCase): |
575 | 548 | """Test the logging.""" | 554 | """Test the logging.""" |
576 | 549 | 555 | ||
577 | 556 | @defer.inlineCallbacks | ||
578 | 550 | def setUp(self): | 557 | def setUp(self): |
579 | 551 | """Set up.""" | 558 | """Set up.""" |
580 | 559 | yield super(LoggingTests, self).setUp() | ||
581 | 552 | self.plt = PathLockingTree() | 560 | self.plt = PathLockingTree() |
582 | 553 | 561 | ||
583 | 554 | self.handler = MementoHandler() | 562 | self.handler = MementoHandler() |
584 | 555 | 563 | ||
585 | === modified file 'tests/syncdaemon/test_states.py' | |||
586 | --- tests/syncdaemon/test_states.py 2011-01-18 20:25:54 +0000 | |||
587 | +++ tests/syncdaemon/test_states.py 2011-10-27 11:43:24 +0000 | |||
588 | @@ -107,7 +107,9 @@ | |||
589 | 107 | class Base(TwistedTestCase): | 107 | class Base(TwistedTestCase): |
590 | 108 | """Base class for state tests.""" | 108 | """Base class for state tests.""" |
591 | 109 | 109 | ||
592 | 110 | @defer.inlineCallbacks | ||
593 | 110 | def setUp(self): | 111 | def setUp(self): |
594 | 112 | yield super(Base, self).setUp() | ||
595 | 111 | # create fake classes | 113 | # create fake classes |
596 | 112 | self.eq = FakeEventQueue() | 114 | self.eq = FakeEventQueue() |
597 | 113 | self.aq = FakeActionQueue() | 115 | self.aq = FakeActionQueue() |
598 | @@ -157,15 +159,18 @@ | |||
599 | 157 | reactor.callLater(.1, check, 0) | 159 | reactor.callLater(.1, check, 0) |
600 | 158 | return d | 160 | return d |
601 | 159 | 161 | ||
602 | 162 | @defer.inlineCallbacks | ||
603 | 160 | def tearDown(self): | 163 | def tearDown(self): |
604 | 164 | yield super(Base, self).tearDown() | ||
605 | 161 | self.sm.connection.shutdown() | 165 | self.sm.connection.shutdown() |
606 | 162 | 166 | ||
607 | 163 | 167 | ||
608 | 164 | class QueueBase(Base): | 168 | class QueueBase(Base): |
609 | 165 | """Basic setup for QueueManager.""" | 169 | """Basic setup for QueueManager.""" |
610 | 166 | 170 | ||
611 | 171 | @defer.inlineCallbacks | ||
612 | 167 | def setUp(self): | 172 | def setUp(self): |
614 | 168 | Base.setUp(self) | 173 | yield super(QueueBase, self).setUp() |
615 | 169 | self.sm.state = StateManager.QUEUE_MANAGER | 174 | self.sm.state = StateManager.QUEUE_MANAGER |
616 | 170 | 175 | ||
617 | 171 | 176 | ||
618 | @@ -223,8 +228,9 @@ | |||
619 | 223 | class TestConnectionManager(Base): | 228 | class TestConnectionManager(Base): |
620 | 224 | """Test the "internal network" transitions.""" | 229 | """Test the "internal network" transitions.""" |
621 | 225 | 230 | ||
622 | 231 | @defer.inlineCallbacks | ||
623 | 226 | def setUp(self): | 232 | def setUp(self): |
625 | 227 | Base.setUp(self) | 233 | yield super(TestConnectionManager, self).setUp() |
626 | 228 | 234 | ||
627 | 229 | # put SM on some state that does not generate further | 235 | # put SM on some state that does not generate further |
628 | 230 | # transition-related efforts for this CM | 236 | # transition-related efforts for this CM |
629 | @@ -341,8 +347,9 @@ | |||
630 | 341 | class TestConnectionManagerTimings(Base): | 347 | class TestConnectionManagerTimings(Base): |
631 | 342 | """Times handled by ConnectionManager.""" | 348 | """Times handled by ConnectionManager.""" |
632 | 343 | 349 | ||
633 | 350 | @defer.inlineCallbacks | ||
634 | 344 | def setUp(self): | 351 | def setUp(self): |
636 | 345 | Base.setUp(self) | 352 | yield super(TestConnectionManagerTimings, self).setUp() |
637 | 346 | 353 | ||
638 | 347 | # set timeout values to really low, to make tests run quicker | 354 | # set timeout values to really low, to make tests run quicker |
639 | 348 | self.sm.connection.handshake_timeout = 0 | 355 | self.sm.connection.handshake_timeout = 0 |
640 | @@ -843,8 +850,10 @@ | |||
641 | 843 | class TestStateManagerPassToNetworkManager(Base): | 850 | class TestStateManagerPassToNetworkManager(Base): |
642 | 844 | """All network events should go to NetworkManager.""" | 851 | """All network events should go to NetworkManager.""" |
643 | 845 | 852 | ||
644 | 853 | @defer.inlineCallbacks | ||
645 | 846 | def setUp(self): | 854 | def setUp(self): |
647 | 847 | Base.setUp(self) | 855 | yield super(TestStateManagerPassToNetworkManager, |
648 | 856 | self).setUp() | ||
649 | 848 | 857 | ||
650 | 849 | # put a function in the middle to log calls | 858 | # put a function in the middle to log calls |
651 | 850 | self.called_events = [] | 859 | self.called_events = [] |
652 | @@ -893,8 +902,10 @@ | |||
653 | 893 | class TestStateManagerPassToQueueManager(Base): | 902 | class TestStateManagerPassToQueueManager(Base): |
654 | 894 | """All queue events should go to QueueManager.""" | 903 | """All queue events should go to QueueManager.""" |
655 | 895 | 904 | ||
656 | 905 | @defer.inlineCallbacks | ||
657 | 896 | def setUp(self): | 906 | def setUp(self): |
659 | 897 | Base.setUp(self) | 907 | yield super(TestStateManagerPassToQueueManager, |
660 | 908 | self).setUp() | ||
661 | 898 | 909 | ||
662 | 899 | # put a function in the middle to log calls | 910 | # put a function in the middle to log calls |
663 | 900 | self.called_events = [] | 911 | self.called_events = [] |
664 | 901 | 912 | ||
665 | === modified file 'tests/syncdaemon/test_status_listener.py' | |||
666 | --- tests/syncdaemon/test_status_listener.py 2011-09-21 14:12:25 +0000 | |||
667 | +++ tests/syncdaemon/test_status_listener.py 2011-10-27 11:43:24 +0000 | |||
668 | @@ -96,9 +96,10 @@ | |||
669 | 96 | class StatusListenerTestCase(FakeMainTestCase): | 96 | class StatusListenerTestCase(FakeMainTestCase): |
670 | 97 | """Tests for StatusListener.""" | 97 | """Tests for StatusListener.""" |
671 | 98 | 98 | ||
672 | 99 | @defer.inlineCallbacks | ||
673 | 99 | def setUp(self): | 100 | def setUp(self): |
674 | 100 | """Initialize this instance.""" | 101 | """Initialize this instance.""" |
676 | 101 | super(StatusListenerTestCase, self).setUp() | 102 | yield super(StatusListenerTestCase, self).setUp() |
677 | 102 | self.status_frontend = FakeStatusFrontend() | 103 | self.status_frontend = FakeStatusFrontend() |
678 | 103 | self.listener = status_listener.StatusListener(self.fs, self.vm, | 104 | self.listener = status_listener.StatusListener(self.fs, self.vm, |
679 | 104 | self.status_frontend) | 105 | self.status_frontend) |
A victory for more deterministic tests.