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

Method test_pool_max_inactive_time_01

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

Source from the content-addressed store, hash-verified

689 await pool.execute('DROP TABLE exmany')
690
691 async def test_pool_max_inactive_time_01(self):
692 async with self.create_pool(
693 database='postgres', init_size=1, min_size=0, max_size=1,
694 max_inactive_connection_lifetime=0.1) as pool:
695
696 # Test that it's OK if a query takes longer time to execute
697 # than `max_inactive_connection_lifetime`.
698
699 con = pool._holders[0]._con
700
701 for _ in range(3):
702 await pool.execute('SELECT pg_sleep(0.5)')
703 self.assertIs(pool._holders[0]._con, con)
704
705 self.assertEqual(
706 await pool.execute('SELECT 1::int'),
707 'SELECT 1')
708 self.assertIs(pool._holders[0]._con, con)
709
710 async def test_pool_max_inactive_time_02(self):
711 async with self.create_pool(

Callers

nothing calls this directly

Calls 2

create_poolMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected