def test_on_retry(self):
     job = Request(
         {
             'task': self.mytask.name,
             'id': uuid(),
             'args': [1],
             'kwargs': {
                 'f': 'x'
             },
         },
         app=self.app)
     job.eventer = MockEventDispatcher()
     try:
         raise Retry('foo', KeyError('moofoobar'))
     except:
         einfo = ExceptionInfo()
         job.on_failure(einfo)
         self.assertIn('task-retried', job.eventer.sent)
         prev, module._does_info = module._does_info, False
         try:
             job.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         job.on_failure(einfo)
Beispiel #2
0
 def test_on_retry(self):
     job = Request({"task": self.mytask.name, "id": uuid(), "args": [1], "kwargs": {"f": "x"}}, app=self.app)
     job.eventer = MockEventDispatcher()
     try:
         raise Retry("foo", KeyError("moofoobar"))
     except:
         einfo = ExceptionInfo()
         job.on_failure(einfo)
         self.assertIn("task-retried", job.eventer.sent)
         prev, module._does_info = module._does_info, False
         try:
             job.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         job.on_failure(einfo)
 def test_on_retry(self):
     job = Request({
         'task': self.mytask.name,
         'id': uuid(),
         'args': [1],
         'kwargs': {'f': 'x'},
     }, app=self.app)
     job.eventer = MockEventDispatcher()
     try:
         raise Retry('foo', KeyError('moofoobar'))
     except:
         einfo = ExceptionInfo()
         job.on_failure(einfo)
         self.assertIn('task-retried', job.eventer.sent)
         prev, module._does_info = module._does_info, False
         try:
             job.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         job.on_failure(einfo)