File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -492,7 +492,7 @@ async def test_cancelled_connection(pool_creator, loop):
492492 # If we receive [(1, 0)] - we retrieved old cursor's values
493493 assert list (res ) == [(2 , 0 )]
494494
495-
495+ @ pytest . mark . run_loop
496496async def test_pool_with_connection_recycling (pool_creator , loop ):
497497 pool = await pool_creator (minsize = 1 , maxsize = 1 , pool_recycle = 3 )
498498 async with pool .get () as conn :
@@ -509,3 +509,18 @@ async def test_pool_with_connection_recycling(pool_creator, loop):
509509 await cur .execute ('SELECT 1;' )
510510 val = await cur .fetchone ()
511511 assert (1 ,) == val
512+
513+ @pytest .mark .run_loop
514+ async def test_pool_does_not_reuse_connection_with_exception (pool_creator , loop ):
515+ pool = await pool_creator (minsize = 1 , maxsize = 1 )
516+
517+ async with pool .get () as conn :
518+ cur = await conn .cursor ()
519+ await cur .execute ('SELECT 1;' )
520+
521+ connection , = pool ._free
522+ connection ._reader .set_exception (IOError ())
523+
524+ async with pool .get () as conn :
525+ cur = await conn .cursor ()
526+ await cur .execute ('SELECT 1;' )
You can’t perform that action at this time.
0 commit comments