예제 #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_on_success_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.time_start = 1
     tw.on_success(42)
     tw._does_info = False
     tw.on_success(42)
     self.assertFalse(tw.acknowledged)
예제 #3
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)
예제 #4
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)
예제 #5
0
 def test_on_success_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.time_start = 1
     tw.on_success(42)
     tw._does_info = False
     tw.on_success(42)
     self.assertFalse(tw.acknowledged)
예제 #6
0
 def test_on_success_acks_late(self):
     job = TaskRequest(
         self.mytask.name, uuid(), [1], {'f': 'x'}, app=self.app,
     )
     job.time_start = 1
     self.mytask.acks_late = True
     job.on_success(42)
     self.assertTrue(job.acknowledged)
예제 #7
0
 def test_on_success_when_failure(self):
     job = TaskRequest(self.mytask.name, uuid(), [1], {"f": "x"}, app=self.app)
     job.time_start = 1
     job.on_failure = Mock()
     try:
         raise KeyError("foo")
     except Exception:
         job.on_success(ExceptionInfo())
         self.assertTrue(job.on_failure.called)
예제 #8
0
 def test_on_success_acks_late(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.time_start = 1
     mytask.acks_late = True
     try:
         tw.on_success(42)
         self.assertTrue(tw.acknowledged)
     finally:
         mytask.acks_late = False
예제 #9
0
 def test_on_success_when_failure(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.time_start = 1
     tw.on_failure = Mock()
     try:
         raise KeyError("foo")
     except Exception:
         tw.on_success(ExceptionInfo())
         self.assertTrue(tw.on_failure.called)
예제 #10
0
 def test_on_success_when_failure(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'}, app=self.app)
     tw.time_start = 1
     tw.on_failure = Mock()
     try:
         raise KeyError('foo')
     except Exception:
         tw.on_success(ExceptionInfo())
         self.assertTrue(tw.on_failure.called)
예제 #11
0
 def test_on_success_acks_late(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.time_start = 1
     mytask.acks_late = True
     try:
         tw.on_success(42)
         self.assertTrue(tw.acknowledged)
     finally:
         mytask.acks_late = False
예제 #12
0
 def test_on_success_when_failure(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.time_start = 1
     tw.on_failure = Mock()
     try:
         raise KeyError("foo")
     except Exception:
         tw.on_success(ExceptionInfo(sys.exc_info()))
         self.assertTrue(tw.on_failure.called)
예제 #13
0
 def test_on_success_acks_early(self):
     job = TaskRequest(self.mytask.name, uuid(), [1], {"f": "x"}, app=self.app)
     job.time_start = 1
     job.on_success(42)
     prev, module._does_info = module._does_info, False
     try:
         job.on_success(42)
         self.assertFalse(job.acknowledged)
     finally:
         module._does_info = prev
예제 #14
0
 def test_on_success_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'})
     tw.time_start = 1
     tw.on_success(42)
     prev, module._does_info = module._does_info, False
     try:
         tw.on_success(42)
         self.assertFalse(tw.acknowledged)
     finally:
         module._does_info = prev
예제 #15
0
 def test_on_success_BaseException(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'}, app=self.app)
     tw.time_start = 1
     with self.assertRaises(SystemExit):
         try:
             raise SystemExit()
         except SystemExit:
             tw.on_success(ExceptionInfo())
         else:
             assert False
예제 #16
0
 def test_on_success_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'}, app=self.app)
     tw.time_start = 1
     tw.on_success(42)
     prev, module._does_info = module._does_info, False
     try:
         tw.on_success(42)
         self.assertFalse(tw.acknowledged)
     finally:
         module._does_info = prev
예제 #17
0
 def test_on_success_BaseException(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.time_start = 1
     with self.assertRaises(SystemExit):
         try:
             raise SystemExit()
         except SystemExit:
             tw.on_success(ExceptionInfo())
         else:
             assert False
예제 #18
0
 def test_on_success_BaseException(self):
     job = TaskRequest(
         self.mytask.name, uuid(), [1], {'f': 'x'}, app=self.app,
     )
     job.time_start = 1
     with self.assertRaises(SystemExit):
         try:
             raise SystemExit()
         except SystemExit:
             job.on_success(ExceptionInfo())
         else:
             assert False