From 120b8d357d5fa6cb0549d4b9afba2a3edbd2e013 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 7 Oct 2021 02:29:00 +0200 Subject: [PATCH] Fix connection delay bias in pool test queue The connection time was mistakenly counted in the execution time, which made the test more brittle than already is. --- tests/pool/test_pool.py | 1 + tests/pool/test_pool_async.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/pool/test_pool.py b/tests/pool/test_pool.py index 6c0f9374d..6abd89553 100644 --- a/tests/pool/test_pool.py +++ b/tests/pool/test_pool.py @@ -292,6 +292,7 @@ def test_queue(dsn, retries): with retry: results = [] with pool.ConnectionPool(dsn, min_size=2) as p: + p.wait() ts = [Thread(target=worker, args=(i,)) for i in range(6)] [t.start() for t in ts] [t.join() for t in ts] diff --git a/tests/pool/test_pool_async.py b/tests/pool/test_pool_async.py index efeb73fc8..e8593946f 100644 --- a/tests/pool/test_pool_async.py +++ b/tests/pool/test_pool_async.py @@ -313,6 +313,7 @@ async def test_queue(dsn, retries): with retry: results = [] async with pool.AsyncConnectionPool(dsn, min_size=2) as p: + await p.wait() ts = [create_task(worker(i)) for i in range(6)] await asyncio.gather(*ts) -- 2.47.3