@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
@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