Commit 173c7baf authored by Denis Bilenko's avatar Denis Bilenko

test__hub.py: add test for signal()

parent df06525e
......@@ -25,6 +25,7 @@ import time
import gevent
from gevent import core
from gevent import socket
import signal
DELAY = 0.1
......@@ -121,6 +122,26 @@ class TestSleep(greentest.GenericWaitTestCase):
gevent.sleep(timeout)
class Expected(Exception):
pass
class TestSignal(greentest.TestCase):
__timeout__ = 2
def test_exception_goes_to_MAIN(self):
def handler():
raise Expected('TestSignal')
gevent.signal(signal.SIGALRM, handler)
signal.alarm(1)
try:
gevent.sleep(1.1)
raise AssertionError('must raise Expected')
except Expected, ex:
assert str(ex) == 'TestSignal', ex
if __name__=='__main__':
greentest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment