Exemple #1
0
 def chord_context(self, size=1):
     with patch('celery.backends.redis.maybe_signature') as ms:
         tasks = [self.create_task() for i in range(size)]
         request = Mock(name='request')
         request.id = 'id1'
         request.group = 'gid1'
         callback = ms.return_value = Signature('add')
         callback.id = 'id1'
         callback['chord_size'] = size
         callback.delay = Mock(name='callback.delay')
         yield tasks, request, callback
Exemple #2
0
 def chord_context(self, size=1):
     with patch("celery.backends.redis.maybe_signature") as ms:
         tasks = [self.create_task() for i in range(size)]
         request = Mock(name="request")
         request.id = "id1"
         request.group = "gid1"
         callback = ms.return_value = Signature("add")
         callback.id = "id1"
         callback["chord_size"] = size
         callback.delay = Mock(name="callback.delay")
         yield tasks, request, callback
Exemple #3
0
 def test_chord_part_return_restore_empty(self, maybe_signature,
                                          GroupResult):
     self.b.implements_incr = True
     GroupResult.restore.return_value = None
     self.b.chord_error_from_stack = Mock()
     callback = Mock(name='callback')
     request = Mock(name='request')
     request.group = 'gid'
     maybe_signature.return_value = callback
     self.b.on_chord_part_return(request, states.SUCCESS, 10)
     self.b.chord_error_from_stack.assert_called_with(
         callback, ANY,
     )