Commit 31a7a0c9 authored by Denis Bilenko's avatar Denis Bilenko

test_hub_join_timeout.py: add testcase for passing Event()

parent 7ce0b531
from __future__ import with_statement
from contextlib import contextmanager
import gevent
from gevent.event import Event
from time import time
......@@ -56,6 +57,22 @@ for _a in xrange(2):
result = gevent.get_hub().join()
assert result is True
# exiting because of event (the spawned greenlet still runs)
for _ in xrange(2):
x = gevent.spawn_later(10, lambda: 5)
event = Event()
event_set = gevent.spawn_later(SMALL, event.set)
with expected_time(SMALL):
result = gevent.get_hub().join(event=event)
assert result is None, repr(result)
assert not x.dead, x
assert event_set.dead
assert event.is_set()
x.kill()
with no_time():
result = gevent.get_hub().join()
assert result is True
# checking "ref=False" argument
for _ in xrange(2):
gevent.get_hub().loop.timer(10, ref=False).start(lambda : None)
......
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