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

Method test_timeout_03

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

Source from the content-addressed store, hash-verified

39 self.assertEqual(await self.con.fetch('select 1'), [(1,)])
40
41 async def test_timeout_03(self):
42 task = self.loop.create_task(
43 self.con.fetch('select pg_sleep(10)', timeout=0.2))
44 await asyncio.sleep(0.05)
45 task.cancel()
46 with self.assertRaises(asyncio.CancelledError), \
47 self.assertRunUnder(MAX_RUNTIME):
48 await task
49 self.assertEqual(await self.con.fetch('select 1'), [(1,)])
50
51 async def test_timeout_04(self):
52 st = await self.con.prepare('select pg_sleep(10)', timeout=0.1)

Callers

nothing calls this directly

Calls 3

assertRunUnderMethod · 0.80
fetchMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected