]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Mark timing based test flaky
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 22 Jun 2021 10:54:02 +0000 (11:54 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 22 Jun 2021 10:54:16 +0000 (11:54 +0100)
tests/pool/test_pool.py
tests/pool/test_pool_async.py

index 6f42b7f0a0b6f23583b255a284a1fd4183310f17..235b0af5cc6080e3659ba2cbdde711fe3f0b0a8b 100644 (file)
@@ -760,16 +760,18 @@ def test_reconnect_failure(proxy):
 
 
 @pytest.mark.slow
-def test_uniform_use(dsn):
-    with pool.ConnectionPool(dsn, min_size=4) as p:
-        counts = Counter()
-        for i in range(8):
-            with p.connection() as conn:
-                sleep(0.1)
-                counts[id(conn)] += 1
-
-    assert len(counts) == 4
-    assert set(counts.values()) == set([2])
+def test_uniform_use(dsn, retries):
+    for retry in retries:
+        with retry:
+            with pool.ConnectionPool(dsn, min_size=4) as p:
+                counts = Counter()
+                for i in range(8):
+                    with p.connection() as conn:
+                        sleep(0.1)
+                        counts[id(conn)] += 1
+
+            assert len(counts) == 4
+            assert set(counts.values()) == set([2])
 
 
 @pytest.mark.slow
index 23894a3c3dd07abb6848c5c515e049b6a2fa08c1..e1c146c35837edb5225b92953f0632842b9b2905 100644 (file)
@@ -773,16 +773,18 @@ async def test_reconnect_failure(proxy):
 
 
 @pytest.mark.slow
-async def test_uniform_use(dsn):
-    async with pool.AsyncConnectionPool(dsn, min_size=4) as p:
-        counts = Counter()
-        for i in range(8):
-            async with p.connection() as conn:
-                await asyncio.sleep(0.1)
-                counts[id(conn)] += 1
-
-    assert len(counts) == 4
-    assert set(counts.values()) == set([2])
+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()
+                for i in range(8):
+                    async with p.connection() as conn:
+                        await asyncio.sleep(0.1)
+                        counts[id(conn)] += 1
+
+            assert len(counts) == 4
+            assert set(counts.values()) == set([2])
 
 
 @pytest.mark.slow