def test_normal_run(self): impl_eventlet.spawn_with(self.mgr, pool=eventlet) eventlet.sleep(0) self.assertEqual(self.before.call_count, 1) self.assertEqual(self.callback.call_count, 1) self.assertEqual(self.after.call_count, 1) self.assertEqual(self.exception_call.call_count, 0)
def test_unexcepted_exception(self): self.callback.side_effect = Exception impl_eventlet.spawn_with(self.mgr, pool=eventlet) eventlet.sleep(0) self.assertEqual(self.before.call_count, 1) self.assertEqual(self.callback.call_count, 1) self.assertEqual(self.after.call_count, 0) self.assertEqual(self.exception_call.call_count, 0)
def test_normal_run(self): thread = impl_eventlet.spawn_with(self.mgr, pool=eventlet) thread.wait() self.assertEqual(1, self.before.call_count) self.assertEqual(1, self.callback.call_count) self.assertEqual(1, self.after.call_count) self.assertEqual(0, self.exception_call.call_count)
def test_unexcepted_exception(self): self.callback.side_effect = Exception thread = impl_eventlet.spawn_with(self.mgr, pool=eventlet) try: thread.wait() except Exception: pass self.assertEqual(1, self.before.call_count) self.assertEqual(1, self.callback.call_count) self.assertEqual(0, self.after.call_count) self.assertEqual(0, self.exception_call.call_count)