def test_send (self): event1 = Event() event2 = Event() spawn(event1.send, 'hello event1') Timeout(0, ValueError('interrupted')) try: result = event1.wait() except ValueError: X = object() result = with_timeout(DELAY, event2.wait, timeout_value = X) assert result is X, 'Nobody sent anything to event2 yet it received %r' % (result, )
def func(): return with_timeout(0.2, sleep, 2, timeout_value=1)
def func (): return with_timeout(0.2, sleep, 2, timeout_value = 1)