From: Daniele Varrazzo Date: Thu, 7 Oct 2021 00:29:00 +0000 (+0200) Subject: Fix connection delay bias in pool test queue X-Git-Tag: 3.0~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=120b8d357d5fa6cb0549d4b9afba2a3edbd2e013;p=thirdparty%2Fpsycopg.git 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. --- 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)