test__pool: fix test_stderr_raising
This commit is contained in:
@@ -90,11 +90,18 @@ class TestCoroutinePool(LimitedTestCase):
|
|||||||
self.assertRaises(RuntimeError, waiter.wait)
|
self.assertRaises(RuntimeError, waiter.wait)
|
||||||
# the pool should have something free at this point since the
|
# the pool should have something free at this point since the
|
||||||
# waiter returned
|
# waiter returned
|
||||||
|
# pool.Pool change: if an exception is raised during execution of a link,
|
||||||
|
# the rest of the links are scheduled to be executed on the next hub iteration
|
||||||
|
# this introduces a delay in updating pool.sem which makes pool.free() report 0
|
||||||
|
# therefore, sleep:
|
||||||
|
api.sleep(0)
|
||||||
self.assertEqual(pool.free(), 1)
|
self.assertEqual(pool.free(), 1)
|
||||||
# shouldn't block when trying to get
|
# shouldn't block when trying to get
|
||||||
t = api.exc_after(0.1, api.TimeoutError)
|
t = api.exc_after(0.1, api.TimeoutError)
|
||||||
self.assert_(pool.get())
|
try:
|
||||||
t.cancel()
|
pool.execute(api.sleep, 1)
|
||||||
|
finally:
|
||||||
|
t.cancel()
|
||||||
finally:
|
finally:
|
||||||
sys.stderr = normal_err
|
sys.stderr = normal_err
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user