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

Method test_timeout_05

tests/test_timeout.py:65–72  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

63 self.assertEqual(await self.con.fetch('select 1'), [(1,)])
64
65 async def test_timeout_05(self):
66 # Stress-test timeouts - try to trigger a race condition
67 # between a cancellation request to Postgres and next
68 # query (SELECT 1)
69 for _ in range(500):
70 with self.assertRaises(asyncio.TimeoutError):
71 await self.con.fetch('SELECT pg_sleep(1)', timeout=1e-10)
72 self.assertEqual(await self.con.fetch('SELECT 1'), [(1,)])
73
74 async def test_timeout_06(self):
75 async with self.con.transaction():

Callers

nothing calls this directly

Calls 1

fetchMethod · 0.45

Tested by

no test coverage detected