Merge lp:~facundo/magicicada-gui/dont-let-mq-die into lp:magicicada-gui

Proposed by Facundo Batista
Status: Merged
Approved by: Natalia Bidart
Approved revision: 53
Merged at revision: 56
Proposed branch: lp:~facundo/magicicada-gui/dont-let-mq-die
Merge into: lp:magicicada-gui
Diff against target: 41 lines (+13/-0)
2 files modified
magicicada/syncdaemon.py (+1/-0)
magicicada/tests/test_syncdaemon.py (+12/-0)
To merge this branch: bzr merge lp:~facundo/magicicada-gui/dont-let-mq-die
Reviewer Review Type Date Requested Status
Natalia Bidart Approve
Review via email: mp+29023@code.launchpad.net

Description of the change

When calling last time to MQ updater, leave the caller in safe state.

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Bu, I got this:

[ERROR]: magicicada.tests.test_syncdaemon.MetaQueueChangedTests.test_mq_caller_is_reset_last_time

Traceback (most recent call last):
  File "/home/nessita/projects/magicicada/review_dont-let-mq-die/magicicada/tests/test_syncdaemon.py", line 498, in test_mq_caller_is_reset_last_time
    self.sd.current_state._set(name='QUEUE_MANAGER',
  File "/home/nessita/projects/magicicada/review_dont-let-mq-die/magicicada/syncdaemon.py", line 56, in __getattribute__
    return object.__getattribute__(self, name)
exceptions.AttributeError: 'State' object has no attribute '_set'

review: Needs Fixing
54. By Facundo Batista <facundo@exopus>

Merged trunk in

55. By Facundo Batista <facundo@exopus>

Fix the test for new API after cleaning.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Now we're talking ;-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'magicicada/syncdaemon.py'
2--- magicicada/syncdaemon.py 2010-06-27 22:19:42 +0000
3+++ magicicada/syncdaemon.py 2010-07-08 22:41:01 +0000
4@@ -253,6 +253,7 @@
5
6 if not self.current_state.processing_meta:
7 logger.info("Check MQ called, States not in MQ, call a last time")
8+ self._mqcaller = None
9 self._get_mq_data()
10 else:
11 logger.info("Asking for MQ information")
12
13=== modified file 'magicicada/tests/test_syncdaemon.py'
14--- magicicada/tests/test_syncdaemon.py 2010-06-27 22:19:42 +0000
15+++ magicicada/tests/test_syncdaemon.py 2010-07-08 22:41:01 +0000
16@@ -480,6 +480,8 @@
17 changed('QUEUE_MANAGER', 'description', False, True, False,
18 'WORKING_ON_CONTENT', 'connection')
19 elif len(called) == 2:
20+ # check that the caller is set back to None
21+ self.assertTrue(self.sd._mqcaller is None)
22 deferred.callback(True)
23 return defer.succeed("foo")
24
25@@ -490,6 +492,16 @@
26 'WORKING_ON_BOTH', 'connection')
27 return deferred
28
29+ def test_mq_caller_is_reset_last_time(self):
30+ """When MQ is polled last time, the caller should be back to None."""
31+ self.sd._mqcaller = reactor.callLater(100, lambda: None)
32+ self.sd.current_state.set(name='QUEUE_MANAGER',
33+ queues='WORKING_ON_CONTENT')
34+
35+ # call the method and check
36+ self.sd._check_mq()
37+ self.assertTrue(self.sd._mqcaller is None)
38+
39 def test_mq_polling_untilfinish(self):
40 """Check that it polls mq until no more is needed."""
41 # set the callback, and adjust the polling time to faster

Subscribers

People subscribed via source and target branches