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

Method test_pool_acquire_timeout

tests/test_adversity.py:52–66  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

50
51 @tb.with_timeout(30.0)
52 async def test_pool_acquire_timeout(self):
53 pool = await self.create_pool(
54 database='postgres', init_size=2, min_size=0, max_size=2)
55 try:
56 self.proxy.trigger_connectivity_loss()
57 for _ in range(2):
58 with self.assertRaises(asyncio.TimeoutError):
59 async with pool.acquire(timeout=0.5):
60 pass
61 self.proxy.restore_connectivity()
62 async with pool.acquire(timeout=0.5):
63 pass
64 finally:
65 self.proxy.restore_connectivity()
66 pool.terminate()
67
68 @tb.with_timeout(30.0)
69 async def test_pool_release_timeout(self):

Callers

nothing calls this directly

Calls 5

restore_connectivityMethod · 0.80
create_poolMethod · 0.45
acquireMethod · 0.45
terminateMethod · 0.45

Tested by

no test coverage detected