(self)
| 1336 | del iterator |
| 1337 | |
| 1338 | async def test_pool_handles_asyncgen_finalization(self): |
| 1339 | pool = await self.create_pool(database='postgres', |
| 1340 | init_size=1, min_size=1, max_size=1) |
| 1341 | |
| 1342 | locals_ = {} |
| 1343 | exec(textwrap.dedent('''\ |
| 1344 | async def iterate(con): |
| 1345 | for record in await con.fetch("SELECT 1"): |
| 1346 | yield record |
| 1347 | '''), globals(), locals_) |
| 1348 | iterate = locals_['iterate'] |
| 1349 | |
| 1350 | class MyException(Exception): |
| 1351 | pass |
| 1352 | |
| 1353 | with self.assertRaises(MyException): |
| 1354 | async with pool.acquire() as con: |
| 1355 | async with con.transaction(): |
| 1356 | async for _ in iterate(con): # noqa |
| 1357 | raise MyException() |
| 1358 | |
| 1359 | async def test_pool_close_waits_for_release(self): |
| 1360 | pool = await self.create_pool(database='postgres', |
nothing calls this directly
no test coverage detected