diff --git a/tests/test_connection.py b/tests/test_connection.py index f0b009c5..98b94b88 100755 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -304,8 +304,10 @@ def inner(future, cursor): task.cancel() + delay = 0.001 + for tick in range(100): - yield from asyncio.sleep(0, loop=loop) + yield from asyncio.sleep(delay, loop=loop) status = conn._conn.get_transaction_status() if status == psycopg2.extensions.TRANSACTION_STATUS_IDLE: cur = yield from conn.cursor() @@ -313,6 +315,7 @@ def inner(future, cursor): ret = yield from cur.fetchone() assert (1,) == ret break + delay *= 2 else: assert False, "Cancelled connection transaction status never got idle"