| 85 | self.assertEqual(await s.fetchval(), 'test') |
| 86 | |
| 87 | async def test_prepare_06_interrupted_close(self): |
| 88 | stmt = await self.con.prepare('''SELECT pg_sleep(10)''') |
| 89 | fut = self.loop.create_task(stmt.fetch()) |
| 90 | |
| 91 | await asyncio.sleep(0.2) |
| 92 | |
| 93 | self.assertFalse(self.con.is_closed()) |
| 94 | await self.con.close() |
| 95 | self.assertTrue(self.con.is_closed()) |
| 96 | |
| 97 | with self.assertRaises(asyncpg.QueryCanceledError): |
| 98 | await fut |
| 99 | |
| 100 | # Test that it's OK to call close again |
| 101 | await self.con.close() |
| 102 | |
| 103 | async def test_prepare_07_interrupted_terminate(self): |
| 104 | stmt = await self.con.prepare('''SELECT pg_sleep(10)''') |