(self)
| 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) |
| 53 | with self.assertRaises(asyncio.TimeoutError), \ |
| 54 | self.assertRunUnder(MAX_RUNTIME): |
| 55 | async with self.con.transaction(): |
| 56 | async for _ in st.cursor(timeout=0.1): # NOQA |
| 57 | pass |
| 58 | self.assertEqual(await self.con.fetch('select 1'), [(1,)]) |
| 59 | |
| 60 | st = await self.con.prepare('select pg_sleep(10)', timeout=0.1) |
| 61 | async with self.con.transaction(): |
| 62 | cur = await st.cursor() |
| 63 | with self.assertRaises(asyncio.TimeoutError), \ |
| 64 | self.assertRunUnder(MAX_RUNTIME): |
| 65 | await cur.fetch(1, timeout=0.1) |
| 66 | self.assertEqual(await self.con.fetch('select 1'), [(1,)]) |
| 67 | |
| 68 | async def test_timeout_05(self): |
| 69 | # Stress-test timeouts - try to trigger a race condition |
nothing calls this directly
no test coverage detected