(self)
| 596 | await run(200, method) |
| 597 | |
| 598 | async def test_pool_connection_execute_many(self): |
| 599 | async def worker(pool): |
| 600 | await asyncio.sleep(random.random() / 100) |
| 601 | await pool.executemany(''' |
| 602 | INSERT INTO exmany VALUES($1, $2) |
| 603 | ''', [ |
| 604 | ('a', 1), ('b', 2), ('c', 3), ('d', 4) |
| 605 | ]) |
| 606 | return 1 |
| 607 | |
| 608 | N = 200 |
| 609 | |
| 610 | async with self.create_pool(database='postgres', |
| 611 | min_size=5, max_size=10) as pool: |
| 612 | |
| 613 | await pool.execute('CREATE TABLE exmany (a text, b int)') |
| 614 | try: |
| 615 | |
| 616 | coros = [worker(pool) for _ in range(N)] |
| 617 | res = await asyncio.gather(*coros) |
| 618 | self.assertEqual(res, [1] * N) |
| 619 | |
| 620 | n_rows = await pool.fetchval('SELECT count(*) FROM exmany') |
| 621 | self.assertEqual(n_rows, N * 4) |
| 622 | |
| 623 | finally: |
| 624 | await pool.execute('DROP TABLE exmany') |
| 625 | |
| 626 | async def test_pool_max_inactive_time_01(self): |
| 627 | async with self.create_pool( |
nothing calls this directly
no test coverage detected