]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Declare type variable for Counter in pool tests
authorDenis Laxalde <denis.laxalde@dalibo.com>
Tue, 2 Nov 2021 12:40:59 +0000 (13:40 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 3 Nov 2021 15:55:14 +0000 (16:55 +0100)
We use the comment-style for type annotation because collections.Counter
is generic only since Python 3.9.

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

index 47a17a252a852bdb9e3c9e524ef7d7a3df4503de..fc30c973042036bf32606b956313739ed737918a 100644 (file)
@@ -818,7 +818,7 @@ def test_uniform_use(dsn, retries):
     for retry in retries:
         with retry:
             with pool.ConnectionPool(dsn, min_size=4) as p:
-                counts = Counter()
+                counts = Counter()  # type: Counter[int]
                 for i in range(8):
                     with p.connection() as conn:
                         sleep(0.1)
index d2542d3137f307d588398c617f408c1c61303c01..9ce51512ea7be8bc559fabd2878643b6b3f1d259 100644 (file)
@@ -812,7 +812,7 @@ async def test_uniform_use(dsn, retries):
     async for retry in retries:
         with retry:
             async with pool.AsyncConnectionPool(dsn, min_size=4) as p:
-                counts = Counter()
+                counts = Counter()  # type: Counter[int]
                 for i in range(8):
                     async with p.connection() as conn:
                         await asyncio.sleep(0.1)