Commit b58abeea authored by Heungsub Lee's avatar Heungsub Lee

Add test case for #607

parent cd634cd7
# A greenlet that's killed with an exception should fail.
import greentest
import gevent
class ExpectedError(greentest.ExpectedException):
pass
class TestKillWithException(greentest.TestCase):
def test_kill_without_exception(self):
g = gevent.spawn()
g.kill()
assert g.successful()
assert isinstance(g.get(), gevent.GreenletExit)
def test_kill_with_exception(self):
g = gevent.spawn()
g.kill(ExpectedError)
assert not g.successful()
self.assertRaises(ExpectedError, g.get)
assert g.value is None
assert isinstance(g.exception, ExpectedError)
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