Commit 35777505 authored by Denis Bilenko's avatar Denis Bilenko

add TestErrorInIterator to test__pool.py

parent 819169f1
...@@ -4,6 +4,7 @@ from gevent import pool ...@@ -4,6 +4,7 @@ from gevent import pool
from gevent.event import Event from gevent.event import Event
import greentest import greentest
import random import random
from greentest import ExpectedException
class TestCoroutinePool(greentest.TestCase): class TestCoroutinePool(greentest.TestCase):
...@@ -346,5 +347,20 @@ class TestSpawn(greentest.TestCase): ...@@ -346,5 +347,20 @@ class TestSpawn(greentest.TestCase):
self.assertEqual(len(p), 0) self.assertEqual(len(p), 0)
class TestErrorInIterator(greentest.TestCase):
error_fatal = False
def test(self):
p = pool.Pool(3)
def iter():
yield 1
yield 2
raise ExpectedException
self.assertRaises(ExpectedException, p.map, lambda x: None, iter())
def unordered(*args):
return list(p.imap_unordered(*args))
self.assertRaises(ExpectedException, unordered, lambda x: None, iter())
if __name__ == '__main__': if __name__ == '__main__':
greentest.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