Commit f5f0701f authored by Denis Bilenko's avatar Denis Bilenko

test__api.py: make sure test cases do not leak greenlets

parent 43a965d8
......@@ -55,24 +55,27 @@ class Test(greentest.TestCase):
def test_sleep_invalid_switch(self):
p = gevent.spawn(util.wrap_errors(AssertionError, gevent.sleep), 2)
gevent.spawn(p.switch, None)
switcher = gevent.spawn(p.switch, None)
result = p.get()
assert isinstance(result, AssertionError), result
assert 'Invalid switch' in str(result), repr(str(result))
switcher.kill()
def test_wait_read_invalid_switch(self):
p = gevent.spawn(util.wrap_errors(AssertionError, socket.wait_read), 0)
gevent.spawn(p.switch, None)
switcher = gevent.spawn(p.switch, None)
result = p.get()
assert isinstance(result, AssertionError), result
assert 'Invalid switch' in str(result), repr(str(result))
switcher.kill()
def test_wait_write_invalid_switch(self):
p = gevent.spawn(util.wrap_errors(AssertionError, socket.wait_write), 0)
gevent.spawn(p.switch, None)
switcher = gevent.spawn(p.switch, None)
result = p.get()
assert isinstance(result, AssertionError), result
assert 'Invalid switch' in str(result), repr(str(result))
switcher.kill()
class TestTimers(greentest.TestCase):
......
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