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

Method test_timeout_01

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

Source from the content-addressed store, hash-verified

21class TestTimeout(tb.ConnectedTestCase):
22
23 async def test_timeout_01(self):
24 for methname in {'fetch', 'fetchrow', 'fetchval', 'execute'}:
25 with self.assertRaises(asyncio.TimeoutError), \
26 self.assertRunUnder(MAX_RUNTIME):
27 meth = getattr(self.con, methname)
28 await meth('select pg_sleep(10)', timeout=0.02)
29 self.assertEqual(await self.con.fetch('select 1'), [(1,)])
30
31 async def test_timeout_02(self):
32 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