MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_pool_max_inactive_time_05

Method test_pool_max_inactive_time_05

tests/test_pool.py:719–735  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

717 self.assertGreaterEqual(N, 50)
718
719 async def test_pool_max_inactive_time_05(self):
720 # Test that idle never-acquired connections abide by
721 # the max inactive lifetime.
722 async with self.create_pool(
723 database='postgres', min_size=2, max_size=2,
724 max_inactive_connection_lifetime=0.2) as pool:
725
726 self.assertIsNotNone(pool._holders[0]._con)
727 self.assertIsNotNone(pool._holders[1]._con)
728
729 await pool.execute('SELECT pg_sleep(0.3)')
730 await asyncio.sleep(0.3)
731
732 self.assertIs(pool._holders[0]._con, None)
733 # The connection in the second holder was never used,
734 # but should be closed nonetheless.
735 self.assertIs(pool._holders[1]._con, None)
736
737 async def test_pool_handles_inactive_connection_errors(self):
738 pool = await self.create_pool(database='postgres',

Callers

nothing calls this directly

Calls 2

create_poolMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected