Commit f90edc40 authored by Denis Bilenko's avatar Denis Bilenko

test__pool.py: add a few tests

parent 113c25a9
......@@ -246,7 +246,7 @@ class TestPoolUnlimit(TestPool):
size = None
class TestJoin(greentest.GenericWaitTestCase):
class TestJoinSleep(greentest.GenericWaitTestCase):
def wait(self, timeout):
p = pool.Pool()
......@@ -254,6 +254,29 @@ class TestJoin(greentest.GenericWaitTestCase):
p.join(timeout=timeout)
class TestJoinEmpty(greentest.TestCase):
switch_expected = False
def test(self):
p = pool.Pool()
p.join()
class TestSpawn(greentest.TestCase):
switch_expected = True
def test(self):
p = pool.Pool(1)
self.assertEqual(len(p), 0)
p.spawn(gevent.sleep, 0.01)
self.assertEqual(len(p), 1)
p.spawn(gevent.sleep, 0.01)
self.assertEqual(len(p), 1)
self.assertEqual(len(p), 1)
gevent.sleep(0.019)
self.assertEqual(len(p), 0)
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