Commit 9f32d104 authored by Denis Bilenko's avatar Denis Bilenko

update test__threadpool.py

parent bf7166dc
...@@ -176,18 +176,19 @@ class TestPool3(TestPool): ...@@ -176,18 +176,19 @@ class TestPool3(TestPool):
class TestPool10(TestPool): class TestPool10(TestPool):
size = 10 size = 10
__timeout__ = 5
# class TestJoinSleep(greentest.GenericGetTestCase): # class TestJoinSleep(greentest.GenericGetTestCase):
# #
# def wait(self, timeout): # def wait(self, timeout):
# pool = ThreadPool(1) # pool = ThreadPool(1)
# pool.spawn(gevent.sleep, 10) # pool.spawn(gevent.sleep, 10)
# pool.join(timeout=timeout) # pool.join(timeout=timeout)
# #
# #
# class TestJoinSleep_raise_error(greentest.GenericWaitTestCase): # class TestJoinSleep_raise_error(greentest.GenericWaitTestCase):
# #
# def wait(self, timeout): # def wait(self, timeout):
# pool = ThreadPool(1) # pool = ThreadPool(1)
# g = pool.spawn(gevent.sleep, 10) # g = pool.spawn(gevent.sleep, 10)
...@@ -252,8 +253,19 @@ class TestMaxsize(TestCase): ...@@ -252,8 +253,19 @@ class TestMaxsize(TestCase):
gevent.sleep(0.01) gevent.sleep(0.01)
self.assertEqual(done, []) self.assertEqual(done, [])
self.pool.maxsize = 1 self.pool.maxsize = 1
gevent.sleep(0.01)
self.assertEqual(done, [1, 2])
def test_setzero(self):
pool = self.pool = ThreadPool(3)
pool.spawn(sleep, 0.001)
pool.spawn(sleep, 0.002)
pool.spawn(sleep, 0.003)
gevent.sleep(0.001) gevent.sleep(0.001)
self.assertEqual(done, [2, 1]) self.assertEqual(pool.size, 3)
pool.maxsize = 0
gevent.sleep(0.01)
self.assertEqual(pool.size, 0)
if __name__ == '__main__': if __name__ == '__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