Esempio n. 1
0
 def test_double_exception(self):
     evt = coros.event()
     # send an exception through the event
     evt.send(exc=RuntimeError('from test_double_exception'))
     self.assertRaises(RuntimeError, evt.wait)
     evt.reset()
     # shouldn't see the RuntimeError again
     api.exc_after(0.001, api.TimeoutError('from test_double_exception'))
     self.assertRaises(api.TimeoutError, evt.wait)
Esempio n. 2
0
 def test_timeout(self):
     import time
     api.exc_after(0.1, api.TimeoutError())
     self.assertRaises(api.TimeoutError, tpool.execute, time.sleep, 0.3)
Esempio n. 3
0
 def setUp(self):
     print('\n%s.%s' % (self.__class__.__name__, self._testMethodName))
     self.timer = api.exc_after(
         self.PER_TEST_TIMEOUT,
         api.TimeoutError('per test timeout expired'))
Esempio n. 4
0
 def setUp(self):
     # raise an exception if we're waiting forever
     self._cancel_timeout = api.exc_after(1, api.TimeoutError())
     self.actor = IncrActor()