]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Fix connection delay bias in pool test queue
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 7 Oct 2021 00:29:00 +0000 (02:29 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 7 Oct 2021 00:31:29 +0000 (02:31 +0200)
The connection time was mistakenly counted in the execution time, which
made the test more brittle than already is.

tests/pool/test_pool.py
tests/pool/test_pool_async.py

index 6c0f9374d839a37507c581f60319f05bd6d57e25..6abd895536561a1da5c0803e5612cf186271dea9 100644 (file)
@@ -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]
index efeb73fc8af2019d428776bb8466d891e2d3dcb0..e8593946ff521b09a235cdd8f1f571dcb6be308b 100644 (file)
@@ -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)