예제 #1
0
 def test_on_success_eventer(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'}, app=self.app)
     tw.time_start = 1
     tw.eventer = Mock()
     tw.send_event = Mock()
     tw.on_success(42)
     self.assertTrue(tw.send_event.called)
예제 #2
0
 def test_send_event(self):
     job = TaskRequest(
         self.mytask.name, uuid(), [1], {'f': 'x'}, app=self.app,
     )
     job.eventer = MockEventDispatcher()
     job.send_event('task-frobulated')
     self.assertIn('task-frobulated', job.eventer.sent)
예제 #3
0
 def test_on_success_eventer(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.time_start = 1
     tw.eventer = Mock()
     tw.send_event = Mock()
     tw.on_success(42)
     self.assertTrue(tw.send_event.called)
예제 #4
0
 def test_on_success_eventer(self):
     job = TaskRequest(self.mytask.name, uuid(), [1], {"f": "x"}, app=self.app)
     job.time_start = 1
     job.eventer = Mock()
     job.send_event = Mock()
     job.on_success(42)
     self.assertTrue(job.send_event.called)
예제 #5
0
 def test_on_retry(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.eventer = MockEventDispatcher()
     try:
         raise RetryTaskError("foo", KeyError("moofoobar"))
     except:
         einfo = ExceptionInfo(sys.exc_info())
         tw.on_failure(einfo)
         self.assertIn("task-retried", tw.eventer.sent)
예제 #6
0
 def test_on_retry(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.eventer = MockEventDispatcher()
     try:
         raise RetryTaskError("foo", KeyError("moofoobar"))
     except:
         einfo = ExceptionInfo(sys.exc_info())
         tw.on_failure(einfo)
         self.assertIn("task-retried", tw.eventer.sent)
예제 #7
0
 def test_on_retry(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'}, app=self.app)
     tw.eventer = MockEventDispatcher()
     try:
         raise RetryTaskError('foo', KeyError('moofoobar'))
     except:
         einfo = ExceptionInfo()
         tw.on_failure(einfo)
         self.assertIn('task-retried', tw.eventer.sent)
         prev, module._does_info = module._does_info, False
         try:
             tw.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         tw.on_failure(einfo)
예제 #8
0
 def test_on_retry(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.eventer = MockEventDispatcher()
     try:
         raise RetryTaskError("foo", KeyError("moofoobar"))
     except:
         einfo = ExceptionInfo()
         tw.on_failure(einfo)
         self.assertIn("task-retried", tw.eventer.sent)
         prev, module._does_info = module._does_info, False
         try:
             tw.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         tw.on_failure(einfo)
예제 #9
0
 def test_on_retry(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'})
     tw.eventer = MockEventDispatcher()
     try:
         raise RetryTaskError('foo', KeyError('moofoobar'))
     except:
         einfo = ExceptionInfo()
         tw.on_failure(einfo)
         self.assertIn('task-retried', tw.eventer.sent)
         prev, module._does_info = module._does_info, False
         try:
             tw.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         tw.on_failure(einfo)
예제 #10
0
 def test_on_retry(self):
     job = TaskRequest(self.mytask.name, uuid(), [1], {"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)
예제 #11
0
 def test_send_event(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.eventer = MockEventDispatcher()
     tw.send_event("task-frobulated")
     self.assertIn("task-frobulated", tw.eventer.sent)
예제 #12
0
 def test_send_event(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.eventer = MockEventDispatcher()
     tw.send_event("task-frobulated")
     self.assertIn("task-frobulated", tw.eventer.sent)
예제 #13
0
 def test_send_event(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'}, app=self.app)
     tw.eventer = MockEventDispatcher()
     tw.send_event('task-frobulated')
     self.assertIn('task-frobulated', tw.eventer.sent)
예제 #14
0
 def test_send_event(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'})
     tw.eventer = MockEventDispatcher()
     tw.send_event('task-frobulated')
     self.assertIn('task-frobulated', tw.eventer.sent)
예제 #15
0
 def test_send_event(self):
     job = TaskRequest(self.mytask.name, uuid(), [1], {"f": "x"}, app=self.app)
     job.eventer = MockEventDispatcher()
     job.send_event("task-frobulated")
     self.assertIn("task-frobulated", job.eventer.sent)