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: mp+80554@code.launchpad.net |
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 | |
6 | from distutils.spawn import find_executable |
7 | |
8 | -from twisted.internet.defer import Deferred |
9 | +from twisted.internet import defer |
10 | from zeitgeist.client import ZeitgeistClient |
11 | from zeitgeist.datamodel import Event, Subject, Interpretation, Manifestation |
12 | |
13 | @@ -92,8 +92,9 @@ |
14 | class ZeitgeistTestCase(DBusTwistedTestCase): |
15 | """Tests for the zeitgeist logging module.""" |
16 | |
17 | + @defer.inlineCallbacks |
18 | def setUp(self): |
19 | - super(ZeitgeistTestCase, self).setUp() |
20 | + yield super(ZeitgeistTestCase, self).setUp() |
21 | zgdaemon = find_executable("zeitgeist-daemon") |
22 | if not zgdaemon: |
23 | raise NotFoundError("zeitgeist-daemon was not found.") |
24 | @@ -138,7 +139,7 @@ |
25 | zg = ZeitgeistLogger() |
26 | self.assertNotEqual(zg.client, None) |
27 | |
28 | - d2 = Deferred() |
29 | + d2 = defer.Deferred() |
30 | |
31 | def logged(id_list): |
32 | """The event was logged to zeitgeist.""" |
33 | |
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 | self._old_home = os.environ['HOME'] |
39 | os.environ['HOME'] = self.home_dir |
40 | |
41 | + @defer.inlineCallbacks |
42 | def tearDown(self): |
43 | os.environ['HOME'] = self._old_home |
44 | - return DBusTwistedTestCase.tearDown(self) |
45 | + yield super(FolderTests, self).tearDown() |
46 | |
47 | def _create_udf(self, id, node_id, suggested_path, subscribed=True): |
48 | """Create an UDF and returns it and the volume.""" |
49 | |
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 | |
55 | |
56 | from mocker import Mocker, ANY |
57 | +from twisted.internet import defer |
58 | from twisted.trial.unittest import TestCase |
59 | |
60 | from ubuntuone.platform.linux.messaging import Messaging, _server_callback |
61 | @@ -42,10 +43,14 @@ |
62 | class MessagingTestCase(TestCase): |
63 | """Test the Messaging API.""" |
64 | |
65 | + @defer.inlineCallbacks |
66 | def setUp(self): |
67 | + yield super(MessagingTestCase, self).setUp() |
68 | self.mocker = Mocker() |
69 | |
70 | + @defer.inlineCallbacks |
71 | def tearDown(self): |
72 | + yield super(MessagingTestCase, self).tearDown() |
73 | self.mocker.restore() |
74 | self.mocker.verify() |
75 | |
76 | |
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 | |
82 | |
83 | from mocker import Mocker |
84 | +from twisted.internet import defer |
85 | from twisted.trial.unittest import TestCase |
86 | |
87 | from ubuntuone.platform.linux.notification import Notification, ICON_NAME |
88 | @@ -45,10 +46,14 @@ |
89 | class NotificationTestCase(TestCase): |
90 | """Test the Messaging API.""" |
91 | |
92 | + @defer.inlineCallbacks |
93 | def setUp(self): |
94 | + yield super(NotificationTestCase, self).setUp() |
95 | self.mocker = Mocker() |
96 | |
97 | + @defer.inlineCallbacks |
98 | def tearDown(self): |
99 | + yield super(NotificationTestCase, self).tearDown() |
100 | self.mocker.restore() |
101 | self.mocker.verify() |
102 | |
103 | |
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 | |
109 | """Tests for the liblauncher interface.""" |
110 | |
111 | +from twisted.internet import defer |
112 | from twisted.trial.unittest import TestCase |
113 | |
114 | from ubuntuone.platform.linux import launcher |
115 | @@ -55,8 +56,10 @@ |
116 | |
117 | skip = None if launcher.use_libunity else "libunity not installed." |
118 | |
119 | + @defer.inlineCallbacks |
120 | def setUp(self): |
121 | """Initialize this test instance.""" |
122 | + yield super(LauncherTestCase, self).setUp() |
123 | self.patch(launcher.Unity, "LauncherEntry", FakeLauncherEntry) |
124 | self.launcher = launcher.UbuntuOneLauncher() |
125 | |
126 | |
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 | import os |
132 | import uuid |
133 | |
134 | +from twisted.internet import defer |
135 | + |
136 | from contrib.testing.testcase import FakeMain, environ |
137 | from tests.syncdaemon.test_vm import MetadataTestCase, BaseVolumeManagerTests |
138 | from ubuntuone.storageprotocol import request |
139 | @@ -44,8 +46,9 @@ |
140 | class MetadataOldLayoutTests(MetadataTestCase): |
141 | """Tests for 'old' layouts and metadata upgrade""" |
142 | |
143 | + @defer.inlineCallbacks |
144 | def setUp(self): |
145 | - MetadataTestCase.setUp(self) |
146 | + yield super(MetadataOldLayoutTests, self).setUp() |
147 | self.root_dir = os.path.join(self.u1_dir, 'My Files') |
148 | self.shares_dir = os.path.join(self.u1_dir, 'Shared With Me') |
149 | self.new_root_dir = self.u1_dir |
150 | @@ -451,8 +454,9 @@ |
151 | class MetadataNewLayoutTests(MetadataTestCase): |
152 | """Test for 'new' layout and metadata upgrade.""" |
153 | |
154 | + @defer.inlineCallbacks |
155 | def setUp(self): |
156 | - MetadataTestCase.setUp(self) |
157 | + yield super(MetadataNewLayoutTests, self).setUp() |
158 | self.share_md_dir = os.path.join(self.vm_data_dir, 'shares') |
159 | self.shared_md_dir = os.path.join(self.vm_data_dir, 'shared') |
160 | self.home_dir = os.path.join(self.tmpdir, 'home', 'ubuntuonehacker') |
161 | |
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 | """Test that the interaction_interfaces are correctly called.""" |
167 | |
168 | from mocker import MockerTestCase, MATCH |
169 | +from twisted.internet import defer |
170 | + |
171 | from tests.platform import IPCTestCase |
172 | |
173 | |
174 | class TestStatusIPC(MockerTestCase, IPCTestCase): |
175 | """Ensure that calls are correctly fowarded.""" |
176 | |
177 | + @defer.inlineCallbacks |
178 | def setUp(self): |
179 | """Set up tests.""" |
180 | - super(TestStatusIPC, self).setUp() |
181 | + yield super(TestStatusIPC, self).setUp() |
182 | self.syncdaemon_status = self.mocker.mock() |
183 | self.status.syncdaemon_status = self.syncdaemon_status |
184 | |
185 | @@ -82,9 +85,10 @@ |
186 | class TestEventsIPC(MockerTestCase, IPCTestCase): |
187 | """Ensure that calls are correctly fowarded.""" |
188 | |
189 | + @defer.inlineCallbacks |
190 | def setUp(self): |
191 | """Set up tests.""" |
192 | - super(TestEventsIPC, self).setUp() |
193 | + yield super(TestEventsIPC, self).setUp() |
194 | self.events_mock = self.mocker.mock() |
195 | self.events.events = self.events_mock |
196 | |
197 | @@ -100,9 +104,10 @@ |
198 | class TestSyncDaemonIPC(MockerTestCase, IPCTestCase): |
199 | """Ensure that calls are correctly fowarded.""" |
200 | |
201 | + @defer.inlineCallbacks |
202 | def setUp(self): |
203 | """Set up tests.""" |
204 | - super(TestSyncDaemonIPC, self).setUp() |
205 | + yield super(TestSyncDaemonIPC, self).setUp() |
206 | self.service = self.mocker.mock() |
207 | self.sync.service = self.service |
208 | |
209 | @@ -174,9 +179,10 @@ |
210 | class TestFileSystemIPC(MockerTestCase, IPCTestCase): |
211 | """Ensure that calls are correctly fowarded.""" |
212 | |
213 | + @defer.inlineCallbacks |
214 | def setUp(self): |
215 | """Set up tests.""" |
216 | - super(TestFileSystemIPC, self).setUp() |
217 | + yield super(TestFileSystemIPC, self).setUp() |
218 | self.syncdaemon_filesystem = self.mocker.mock() |
219 | self.fs.syncdaemon_filesystem = self.syncdaemon_filesystem |
220 | |
221 | @@ -221,9 +227,10 @@ |
222 | class TestSharesIPC(MockerTestCase, IPCTestCase): |
223 | """Ensure that calls are correctly fowarded.""" |
224 | |
225 | + @defer.inlineCallbacks |
226 | def setUp(self): |
227 | """Set up tests.""" |
228 | - super(TestSharesIPC, self).setUp() |
229 | + yield super(TestSharesIPC, self).setUp() |
230 | self.syncdaemon_shares = self.mocker.mock() |
231 | self.shares.syncdaemon_shares = self.syncdaemon_shares |
232 | |
233 | @@ -316,9 +323,10 @@ |
234 | class TestConfigIPC(MockerTestCase, IPCTestCase): |
235 | """Ensure that calls are correctly fowarded.""" |
236 | |
237 | + @defer.inlineCallbacks |
238 | def setUp(self): |
239 | """Set up tests.""" |
240 | - super(TestConfigIPC, self).setUp() |
241 | + yield super(TestConfigIPC, self).setUp() |
242 | self.syncdaemon_config = self.mocker.mock() |
243 | self.config.syncdaemon_config = self.syncdaemon_config |
244 | |
245 | @@ -467,9 +475,10 @@ |
246 | class TestFoldersIPC(MockerTestCase, IPCTestCase): |
247 | """Ensure that calls are correctly fowarded.""" |
248 | |
249 | + @defer.inlineCallbacks |
250 | def setUp(self): |
251 | """Set up tests.""" |
252 | - super(TestFoldersIPC, self).setUp() |
253 | + yield super(TestFoldersIPC, self).setUp() |
254 | self.syncdaemon_folders = self.mocker.mock() |
255 | self.folders.syncdaemon_folders = self.syncdaemon_folders |
256 | |
257 | @@ -528,9 +537,10 @@ |
258 | class TestPublicFilesIPC(MockerTestCase, IPCTestCase): |
259 | """Ensure that calls are correctly fowarded.""" |
260 | |
261 | + @defer.inlineCallbacks |
262 | def setUp(self): |
263 | """Set up tests.""" |
264 | - super(TestPublicFilesIPC, self).setUp() |
265 | + yield super(TestPublicFilesIPC, self).setUp() |
266 | self.syncdaemon_public_files = self.mocker.mock() |
267 | self.public_files.syncdaemon_public_files =\ |
268 | self.syncdaemon_public_files |
269 | |
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 | |
275 | TIMEOUT = 3.0 |
276 | |
277 | + @defer.inlineCallbacks |
278 | def setUp(self): |
279 | """Initialize this test instance.""" |
280 | + yield super(TimerTestCase, self).setUp() |
281 | self.clock = PatchedClock() |
282 | self.timer = aggregator.Timer(delay=3.0, clock=self.clock) |
283 | |
284 | @@ -101,8 +103,10 @@ |
285 | |
286 | DELAY = 0.5 |
287 | |
288 | + @defer.inlineCallbacks |
289 | def setUp(self): |
290 | """Initialize this test instance.""" |
291 | + yield super(DeadlineTimerTestCase, self).setUp() |
292 | self.clock = PatchedClock() |
293 | self.timer = aggregator.DeadlineTimer(delay=0.5, timeout=3.0, |
294 | clock=self.clock) |
295 | @@ -242,8 +246,10 @@ |
296 | class ToggleableNotificationTestCase(TestCase): |
297 | """Test the ToggleableNotification class.""" |
298 | |
299 | + @defer.inlineCallbacks |
300 | def setUp(self): |
301 | """Initialize this test instance.""" |
302 | + yield super(ToggleableNotificationTestCase, self).setUp() |
303 | self.patch(aggregator, "Notification", FakeNotification) |
304 | self.notification_switch = aggregator.NotificationSwitch() |
305 | self.toggleable = self.notification_switch.get_notification() |
306 | @@ -282,8 +288,10 @@ |
307 | class NotificationSwitchTestCase(TestCase): |
308 | """Test the NotificationSwitch class.""" |
309 | |
310 | + @defer.inlineCallbacks |
311 | def setUp(self): |
312 | """Initialize this test instance.""" |
313 | + yield super(NotificationSwitchTestCase, self).setUp() |
314 | self.notification_switch = aggregator.NotificationSwitch() |
315 | |
316 | def test_get_notification(self): |
317 | @@ -306,8 +314,10 @@ |
318 | class FileDiscoveryBubbleTestCase(TestCase): |
319 | """Test the FileDiscoveryBubble class.""" |
320 | |
321 | + @defer.inlineCallbacks |
322 | def setUp(self): |
323 | """Initialize this test instance.""" |
324 | + yield super(FileDiscoveryBubbleTestCase, self).setUp() |
325 | self.patch(aggregator, "ToggleableNotification", |
326 | FakeNotificationSingleton()) |
327 | self.clock = PatchedClock() |
328 | @@ -487,8 +497,10 @@ |
329 | class FinalBubbleTestCase(TestCase): |
330 | """Test for the final status notification bubble.""" |
331 | |
332 | + @defer.inlineCallbacks |
333 | def setUp(self): |
334 | """Initialize this test instance.""" |
335 | + yield super(FinalBubbleTestCase, self).setUp() |
336 | self.patch(aggregator, "ToggleableNotification", |
337 | FakeNotificationSingleton()) |
338 | self.clock = PatchedClock() |
339 | @@ -542,8 +554,10 @@ |
340 | class ProgressBarTestCase(TestCase): |
341 | """Tests for the progress bar.""" |
342 | |
343 | + @defer.inlineCallbacks |
344 | def setUp(self): |
345 | """Initialize this test instance.""" |
346 | + yield super(ProgressBarTestCase, self).setUp() |
347 | self.patch(aggregator, "UbuntuOneLauncher", FakeLauncher) |
348 | self.patch(aggregator.session, "Inhibitor", FakeInhibitor) |
349 | self.clock = PatchedClock() |
350 | @@ -1035,8 +1049,10 @@ |
351 | CLASS_KWARGS = {} |
352 | status = None |
353 | |
354 | + @defer.inlineCallbacks |
355 | def setUp(self): |
356 | """Initialize this test instance.""" |
357 | + yield super(StatusEventTestCase, self).setUp() |
358 | if type(self) == StatusEventTestCase: |
359 | self.assertRaises(AssertionError, self.CLASS, **self.CLASS_KWARGS) |
360 | else: |
361 | @@ -1179,8 +1195,10 @@ |
362 | class StatusAggregatorTestCase(TestCase): |
363 | """Test the backend of the status aggregator.""" |
364 | |
365 | + @defer.inlineCallbacks |
366 | def setUp(self): |
367 | """Initialize this test instance.""" |
368 | + yield super(StatusAggregatorTestCase, self).setUp() |
369 | self.patch(aggregator, "FileDiscoveryBubble", |
370 | FakeFileDiscoveryBubble) |
371 | self.patch(aggregator, "FinalStatusBubble", |
372 | |
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 | @defer.inlineCallbacks |
378 | def tearDown(self): |
379 | """Cleanup.""" |
380 | + yield super(BasicTestCase, self).tearDown() |
381 | for record in self.handler.records: |
382 | exc_info = getattr(record, 'exc_info', None) |
383 | if exc_info is not None: |
384 | @@ -442,8 +443,10 @@ |
385 | class TestRequestQueue(TwistedTestCase): |
386 | """Tests for the RequestQueue.""" |
387 | |
388 | + @defer.inlineCallbacks |
389 | def setUp(self): |
390 | """Set up.""" |
391 | + yield super(TestRequestQueue, self).setUp() |
392 | |
393 | class FakeAQ(object): |
394 | """Fake AQ.""" |
395 | @@ -765,8 +768,10 @@ |
396 | class TestDeferredMap(TwistedTestCase): |
397 | """Test the deferred map.""" |
398 | |
399 | + @defer.inlineCallbacks |
400 | def setUp(self): |
401 | """Set up.""" |
402 | + yield super(TestDeferredMap, self).setUp() |
403 | self.dm = DeferredMap() |
404 | |
405 | def test_one_get_returns_stored_deferred(self): |
406 | @@ -853,8 +858,10 @@ |
407 | class TestZipQueue(TwistedTestCase): |
408 | """Test the zipping queue.""" |
409 | |
410 | + @defer.inlineCallbacks |
411 | def setUp(self): |
412 | """Set up.""" |
413 | + yield super(TestZipQueue, self).setUp() |
414 | self.zq = ZipQueue() |
415 | |
416 | @defer.inlineCallbacks |
417 | @@ -5007,8 +5014,10 @@ |
418 | class ActionQueueProtocolTests(TwistedTestCase): |
419 | """Test the ACQ class.""" |
420 | |
421 | + @defer.inlineCallbacks |
422 | def setUp(self): |
423 | """Set up.""" |
424 | + yield super(ActionQueueProtocolTests, self).setUp() |
425 | # create an AQP and put a factory to it |
426 | self.aqp = ActionQueueProtocol() |
427 | obj = Mocker().mock() |
428 | @@ -5020,8 +5029,10 @@ |
429 | self.handler.setLevel(logging.DEBUG) |
430 | self.aqp.log.addHandler(self.handler) |
431 | |
432 | + @defer.inlineCallbacks |
433 | def tearDown(self): |
434 | """Tear down.""" |
435 | + yield super(ActionQueueProtocolTests, self).tearDown() |
436 | self.aqp.log.removeHandler(self.handler) |
437 | if self.aqp.ping_manager is not None: |
438 | self.aqp.ping_manager.stop() |
439 | @@ -5629,8 +5640,10 @@ |
440 | class ConditionsLockerTests(TwistedTestCase): |
441 | """Test the ConditionsLocker.""" |
442 | |
443 | + @defer.inlineCallbacks |
444 | def setUp(self): |
445 | """Set up.""" |
446 | + yield super(ConditionsLockerTests, self).setUp() |
447 | self.cl = ConditionsLocker() |
448 | |
449 | def test_get_locking_deferred_returns_deferred(self): |
450 | @@ -5752,8 +5765,11 @@ |
451 | class PingManagerTestCase(TwistedTestCase): |
452 | """Test the Ping manager.""" |
453 | |
454 | + @defer.inlineCallbacks |
455 | def setUp(self): |
456 | """Set up.""" |
457 | + yield super(PingManagerTestCase, self).setUp() |
458 | + |
459 | class FakeActionQueueProtocol(object): |
460 | """Fake object for the tests.""" |
461 | log = logging.getLogger("ubuntuone.SyncDaemon.ActionQueue") |
462 | @@ -5765,8 +5781,10 @@ |
463 | self.fake_aqp.log.addHandler(self.handler) |
464 | self.pm = PingManager(self.fake_aqp) |
465 | |
466 | + @defer.inlineCallbacks |
467 | def tearDown(self): |
468 | """Tear down.""" |
469 | + yield super(PingManagerTestCase, self).tearDown() |
470 | self.fake_aqp.log.removeHandler(self.handler) |
471 | self.pm.stop() |
472 | |
473 | |
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 | |
479 | import logging |
480 | |
481 | +from twisted.internet import defer |
482 | from twisted.trial import unittest |
483 | |
484 | from ubuntuone.devtools.handlers import MementoHandler |
485 | @@ -39,15 +40,19 @@ |
486 | class DebugCaptureTest(unittest.TestCase): |
487 | """Tests for DebugCapture context manager.""" |
488 | |
489 | + @defer.inlineCallbacks |
490 | def setUp(self): |
491 | """Setup the logger and the handler""" |
492 | + yield super(DebugCaptureTest, self).setUp() |
493 | self.handler = MementoHandler() |
494 | self.logger = logging.getLogger(self.__class__.__name__) |
495 | self.logger.addHandler(self.handler) |
496 | self.logger.setLevel(logging.DEBUG) |
497 | |
498 | + @defer.inlineCallbacks |
499 | def tearDown(self): |
500 | """close the handler and restore the logger (Logger's are global)""" |
501 | + yield super(DebugCaptureTest, self).tearDown() |
502 | self.handler.close() |
503 | self.logger.removeHandler(self.handler) |
504 | self.logger.setLevel(logging.DEBUG) |
505 | @@ -222,8 +227,10 @@ |
506 | class FilterTests(unittest.TestCase): |
507 | """Tests log filters""" |
508 | |
509 | + @defer.inlineCallbacks |
510 | def setUp(self): |
511 | """Setup the logger and the handler""" |
512 | + yield super(FilterTests, self).setUp() |
513 | self.handler = MementoHandler() |
514 | self.handler.setLevel(logging.DEBUG) |
515 | root_logger.addHandler(self.handler) |
516 | @@ -253,15 +260,19 @@ |
517 | class MultiFilterTest(unittest.TestCase): |
518 | """Tests for logger.MultiFilter""" |
519 | |
520 | + @defer.inlineCallbacks |
521 | def setUp(self): |
522 | """Setup the logger and the handler""" |
523 | + yield super(MultiFilterTest, self).setUp() |
524 | self.handler = MementoHandler() |
525 | self.logger = logging.getLogger(self.__class__.__name__) |
526 | self.logger.addHandler(self.handler) |
527 | self.logger.setLevel(logging.DEBUG) |
528 | |
529 | + @defer.inlineCallbacks |
530 | def tearDown(self): |
531 | """close the handler and restore the logger (Logger's are global)""" |
532 | + yield super(MultiFilterTest, self).tearDown() |
533 | self.handler.close() |
534 | self.logger.removeHandler(self.handler) |
535 | self.logger.setLevel(logging.DEBUG) |
536 | |
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 | class InternalDeferredTests(TwistedTestCase): |
542 | """Test the internal deferreds handling functionality.""" |
543 | |
544 | + @defer.inlineCallbacks |
545 | def setUp(self): |
546 | """Set up.""" |
547 | + yield super(InternalDeferredTests, self).setUp() |
548 | self.plt = PathLockingTree() |
549 | |
550 | def test_single_element_old(self): |
551 | @@ -217,8 +219,10 @@ |
552 | class LockingTests(TwistedTestCase): |
553 | """Test the locking between elements.""" |
554 | |
555 | + @defer.inlineCallbacks |
556 | def setUp(self): |
557 | """Set up.""" |
558 | + yield super(LockingTests, self).setUp() |
559 | self.plt = PathLockingTree() |
560 | |
561 | @defer.inlineCallbacks |
562 | @@ -417,8 +421,10 @@ |
563 | class CleaningTests(TwistedTestCase): |
564 | """Test that the releases clean the tree.""" |
565 | |
566 | + @defer.inlineCallbacks |
567 | def setUp(self): |
568 | """Set up.""" |
569 | + yield super(CleaningTests, self).setUp() |
570 | self.plt = PathLockingTree() |
571 | |
572 | @defer.inlineCallbacks |
573 | @@ -547,8 +553,10 @@ |
574 | class LoggingTests(TwistedTestCase): |
575 | """Test the logging.""" |
576 | |
577 | + @defer.inlineCallbacks |
578 | def setUp(self): |
579 | """Set up.""" |
580 | + yield super(LoggingTests, self).setUp() |
581 | self.plt = PathLockingTree() |
582 | |
583 | self.handler = MementoHandler() |
584 | |
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 | class Base(TwistedTestCase): |
590 | """Base class for state tests.""" |
591 | |
592 | + @defer.inlineCallbacks |
593 | def setUp(self): |
594 | + yield super(Base, self).setUp() |
595 | # create fake classes |
596 | self.eq = FakeEventQueue() |
597 | self.aq = FakeActionQueue() |
598 | @@ -157,15 +159,18 @@ |
599 | reactor.callLater(.1, check, 0) |
600 | return d |
601 | |
602 | + @defer.inlineCallbacks |
603 | def tearDown(self): |
604 | + yield super(Base, self).tearDown() |
605 | self.sm.connection.shutdown() |
606 | |
607 | |
608 | class QueueBase(Base): |
609 | """Basic setup for QueueManager.""" |
610 | |
611 | + @defer.inlineCallbacks |
612 | def setUp(self): |
613 | - Base.setUp(self) |
614 | + yield super(QueueBase, self).setUp() |
615 | self.sm.state = StateManager.QUEUE_MANAGER |
616 | |
617 | |
618 | @@ -223,8 +228,9 @@ |
619 | class TestConnectionManager(Base): |
620 | """Test the "internal network" transitions.""" |
621 | |
622 | + @defer.inlineCallbacks |
623 | def setUp(self): |
624 | - Base.setUp(self) |
625 | + yield super(TestConnectionManager, self).setUp() |
626 | |
627 | # put SM on some state that does not generate further |
628 | # transition-related efforts for this CM |
629 | @@ -341,8 +347,9 @@ |
630 | class TestConnectionManagerTimings(Base): |
631 | """Times handled by ConnectionManager.""" |
632 | |
633 | + @defer.inlineCallbacks |
634 | def setUp(self): |
635 | - Base.setUp(self) |
636 | + yield super(TestConnectionManagerTimings, self).setUp() |
637 | |
638 | # set timeout values to really low, to make tests run quicker |
639 | self.sm.connection.handshake_timeout = 0 |
640 | @@ -843,8 +850,10 @@ |
641 | class TestStateManagerPassToNetworkManager(Base): |
642 | """All network events should go to NetworkManager.""" |
643 | |
644 | + @defer.inlineCallbacks |
645 | def setUp(self): |
646 | - Base.setUp(self) |
647 | + yield super(TestStateManagerPassToNetworkManager, |
648 | + self).setUp() |
649 | |
650 | # put a function in the middle to log calls |
651 | self.called_events = [] |
652 | @@ -893,8 +902,10 @@ |
653 | class TestStateManagerPassToQueueManager(Base): |
654 | """All queue events should go to QueueManager.""" |
655 | |
656 | + @defer.inlineCallbacks |
657 | def setUp(self): |
658 | - Base.setUp(self) |
659 | + yield super(TestStateManagerPassToQueueManager, |
660 | + self).setUp() |
661 | |
662 | # put a function in the middle to log calls |
663 | self.called_events = [] |
664 | |
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 | class StatusListenerTestCase(FakeMainTestCase): |
670 | """Tests for StatusListener.""" |
671 | |
672 | + @defer.inlineCallbacks |
673 | def setUp(self): |
674 | """Initialize this instance.""" |
675 | - super(StatusListenerTestCase, self).setUp() |
676 | + yield super(StatusListenerTestCase, self).setUp() |
677 | self.status_frontend = FakeStatusFrontend() |
678 | self.listener = status_listener.StatusListener(self.fs, self.vm, |
679 | self.status_frontend) |
A victory for more deterministic tests.