(self)
| 46 | self.assertEqual(await self.con.fetch('select 1'), [(1,)]) |
| 47 | |
| 48 | async def test_timeout_04(self): |
| 49 | st = await self.con.prepare('select pg_sleep(10)', timeout=0.1) |
| 50 | with self.assertRaises(asyncio.TimeoutError), \ |
| 51 | self.assertRunUnder(MAX_RUNTIME): |
| 52 | async with self.con.transaction(): |
| 53 | async for _ in st.cursor(timeout=0.1): # NOQA |
| 54 | pass |
| 55 | self.assertEqual(await self.con.fetch('select 1'), [(1,)]) |
| 56 | |
| 57 | st = await self.con.prepare('select pg_sleep(10)', timeout=0.1) |
| 58 | async with self.con.transaction(): |
| 59 | cur = await st.cursor() |
| 60 | with self.assertRaises(asyncio.TimeoutError), \ |
| 61 | self.assertRunUnder(MAX_RUNTIME): |
| 62 | await cur.fetch(1, timeout=0.1) |
| 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 |
nothing calls this directly
no test coverage detected