(self)
| 72 | self.assertEqual(await self.con.fetch('SELECT 1'), [(1,)]) |
| 73 | |
| 74 | async def test_timeout_06(self): |
| 75 | async with self.con.transaction(): |
| 76 | with self.assertRaises(asyncio.TimeoutError), \ |
| 77 | self.assertRunUnder(MAX_RUNTIME): |
| 78 | async for _ in self.con.cursor( # NOQA |
| 79 | 'select pg_sleep(10)', timeout=0.1): |
| 80 | pass |
| 81 | self.assertEqual(await self.con.fetch('select 1'), [(1,)]) |
| 82 | |
| 83 | async with self.con.transaction(): |
| 84 | cur = await self.con.cursor('select pg_sleep(10)') |
| 85 | with self.assertRaises(asyncio.TimeoutError), \ |
| 86 | self.assertRunUnder(MAX_RUNTIME): |
| 87 | await cur.fetch(1, timeout=0.1) |
| 88 | |
| 89 | async with self.con.transaction(): |
| 90 | cur = await self.con.cursor('select pg_sleep(10)') |
| 91 | with self.assertRaises(asyncio.TimeoutError), \ |
| 92 | self.assertRunUnder(MAX_RUNTIME): |
| 93 | await cur.forward(1, timeout=1e-10) |
| 94 | |
| 95 | async with self.con.transaction(): |
| 96 | cur = await self.con.cursor('select pg_sleep(10)') |
| 97 | with self.assertRaises(asyncio.TimeoutError), \ |
| 98 | self.assertRunUnder(MAX_RUNTIME): |
| 99 | await cur.fetchrow(timeout=0.1) |
| 100 | |
| 101 | async with self.con.transaction(): |
| 102 | cur = await self.con.cursor('select pg_sleep(10)') |
| 103 | with self.assertRaises(asyncio.TimeoutError), \ |
| 104 | self.assertRunUnder(MAX_RUNTIME): |
| 105 | await cur.fetchrow(timeout=0.1) |
| 106 | |
| 107 | with self.assertRaises(asyncpg.InFailedSQLTransactionError): |
| 108 | await cur.fetch(1) |
| 109 | |
| 110 | self.assertEqual(await self.con.fetch('select 1'), [(1,)]) |
| 111 | |
| 112 | async def test_invalid_timeout(self): |
| 113 | for command_timeout in ('a', False, -1): |
nothing calls this directly
no test coverage detected