import unittest
from eventlet.coros import event
from eventlet.api import spawn, sleep

class Test(unittest.TestCase):
    
    def test_send_exc(self):
        log = []
        e = event()

        def waiter():
            try:
                result = e.wait()
                log.append(('received', result))
            except Exception, ex:
                log.append(('catched', type(ex).__name__))
        spawn(waiter)
        sleep(0) # let waiter to block on e.wait()
        e.send(exc=Exception())
        sleep(0)
        assert log == [('catched', 'Exception')], log

if __name__=='__main__':
    unittest.main()




test for coros.event's bug: cannot send an exception