Exemplo n.º 1
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)
Exemplo n.º 2
0
 def test_already_revoked(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'})
     tw._already_revoked = True
     self.assertTrue(tw.revoked())
Exemplo n.º 3
0
 def test_on_accepted_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
     self.assertTrue(tw.acknowledged)
     tw._does_debug = False
     tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
Exemplo n.º 4
0
 def test_task_wrapper_repr(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'})
     self.assertTrue(repr(tw))
Exemplo n.º 5
0
 def test_revoked(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     revoked.add(tw.id)
     self.assertTrue(tw.revoked())
     self.assertTrue(tw._already_revoked)
     self.assertTrue(tw.acknowledged)
Exemplo n.º 6
0
 def test_execute_using_pool_does_not_execute_revoked(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     revoked.add(tw.id)
     tw.execute_using_pool(None)
Exemplo n.º 7
0
 def test_on_success_acks_early(self):
     tw = TaskRequest(mytask.name, gen_unique_id(), [1], {"f": "x"})
     tw.time_start = 1
     tw.on_success(42)
     self.assertFalse(tw.acknowledged)
Exemplo n.º 8
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)
Exemplo n.º 9
0
 def test_execute_does_not_execute_revoked(self):
     tw = TaskRequest(mytask.name, gen_unique_id(), [1], {"f": "x"})
     revoked.add(tw.task_id)
     tw.execute()
Exemplo n.º 10
0
 def test_on_accepted_acks_early(self):
     tw = TaskRequest(mytask.name, gen_unique_id(), [1], {"f": "x"})
     tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
     self.assertTrue(tw.acknowledged)
Exemplo n.º 11
0
 def test_already_revoked(self):
     tw = TaskRequest(mytask.name, gen_unique_id(), [1], {"f": "x"})
     tw._already_revoked = True
     self.assertTrue(tw.revoked())
Exemplo n.º 12
0
 def test_task_wrapper_repr(self):
     tw = TaskRequest(mytask.name, gen_unique_id(), [1], {"f": "x"})
     self.assertTrue(repr(tw))
Exemplo n.º 13
0
 def test_execute_using_pool_does_not_execute_revoked(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'})
     revoked.add(tw.id)
     with self.assertRaises(TaskRevokedError):
         tw.execute_using_pool(None)
Exemplo n.º 14
0
 def test_execute_does_not_execute_revoked(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'})
     revoked.add(tw.id)
     tw.execute()
Exemplo n.º 15
0
 def test_executed_bit(self):
     tw = TaskRequest(mytask.name, gen_unique_id(), [], {})
     self.assertFalse(tw.executed)
     tw._set_executed_bit()
     self.assertTrue(tw.executed)
     self.assertRaises(AlreadyExecutedError, tw._set_executed_bit)