From bc9f4a9a1d1b0ae636be81762ec4d5849ec583c5 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 22 Jun 2021 11:54:02 +0100 Subject: [PATCH] Mark timing based test flaky --- tests/pool/test_pool.py | 22 ++++++++++++---------- tests/pool/test_pool_async.py | 22 ++++++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/tests/pool/test_pool.py b/tests/pool/test_pool.py index 6f42b7f0a..235b0af5c 100644 --- a/tests/pool/test_pool.py +++ b/tests/pool/test_pool.py @@ -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 diff --git a/tests/pool/test_pool_async.py b/tests/pool/test_pool_async.py index 23894a3c3..e1c146c35 100644 --- a/tests/pool/test_pool_async.py +++ b/tests/pool/test_pool_async.py @@ -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 -- 2.47.3