Commit ce284562 authored by Denis Bilenko's avatar Denis Bilenko

test__api.py: update test for spawn_later

parent dd96ee31
...@@ -53,11 +53,14 @@ class Test(greentest.TestCase): ...@@ -53,11 +53,14 @@ class Test(greentest.TestCase):
def test_killing_not_yet_started(self): def test_killing_not_yet_started(self):
def func(): def func():
pass pass
g = gevent.spawn_later(2000, func) g, timer = gevent.spawn_later(2000, func)
assert not g.dead, g try:
g.kill(block=True) assert not g.dead, g
assert g.dead, g g.kill(block=True)
self.assertRaises(Exception, g.get) assert g.dead, g
self.assertRaises(Exception, g.get)
finally:
timer.cancel()
def test_sleep_invalid_switch(self): def test_sleep_invalid_switch(self):
p = gevent.spawn(util.wrap_errors(AssertionError, gevent.sleep), 2) p = gevent.spawn(util.wrap_errors(AssertionError, gevent.sleep), 2)
......
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