fix pools_test
This commit is contained in:
@@ -124,6 +124,7 @@ class TestIntPool(TestCase):
|
|||||||
|
|
||||||
def test_putting_to_queue(self):
|
def test_putting_to_queue(self):
|
||||||
timer = api.exc_after(0.1, api.TimeoutError)
|
timer = api.exc_after(0.1, api.TimeoutError)
|
||||||
|
try:
|
||||||
size = 2
|
size = 2
|
||||||
self.pool = IntPool(min_size=0, max_size=size)
|
self.pool = IntPool(min_size=0, max_size=size)
|
||||||
queue = coros.queue()
|
queue = coros.queue()
|
||||||
@@ -135,9 +136,11 @@ class TestIntPool(TestCase):
|
|||||||
pool_item = self.pool.get()
|
pool_item = self.pool.get()
|
||||||
api.spawn(just_put, pool_item, index)
|
api.spawn(just_put, pool_item, index)
|
||||||
|
|
||||||
while results != range(size + 1):
|
for _ in range(size+1):
|
||||||
x = queue.wait()
|
x = queue.wait()
|
||||||
results.append(x)
|
results.append(x)
|
||||||
|
self.assertEqual(sorted(results), range(size + 1))
|
||||||
|
finally:
|
||||||
timer.cancel()
|
timer.cancel()
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user