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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)