MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / test_timeout_01

Method test_timeout_01

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

Source from the content-addressed store, hash-verified

18class TestTimeout(tb.ConnectedTestCase):
19
20 async def test_timeout_01(self):
21 for methname in {'fetch', 'fetchrow', 'fetchval', 'execute'}:
22 with self.assertRaises(asyncio.TimeoutError), \
23 self.assertRunUnder(MAX_RUNTIME):
24 meth = getattr(self.con, methname)
25 await meth('select pg_sleep(10)', timeout=0.02)
26 self.assertEqual(await self.con.fetch('select 1'), [(1,)])
27
28 async def test_timeout_02(self):
29 st = await self.con.prepare('select pg_sleep(10)')

Callers

nothing calls this directly

Calls 2

assertRunUnderMethod · 0.80
fetchMethod · 0.45

Tested by

no test coverage detected