(self)
| 659 | await run(200, method) |
| 660 | |
| 661 | async def test_pool_connection_execute_many(self): |
| 662 | async def worker(pool): |
| 663 | await asyncio.sleep(random.random() / 100) |
| 664 | await pool.executemany(''' |
| 665 | INSERT INTO exmany VALUES($1, $2) |
| 666 | ''', [ |
| 667 | ('a', 1), ('b', 2), ('c', 3), ('d', 4) |
| 668 | ]) |
| 669 | return 1 |
| 670 | |
| 671 | N = 200 |
| 672 | |
| 673 | async with self.create_pool(database='postgres', |
| 674 | init_size=5, |
| 675 | min_size=0, |
| 676 | max_size=10) as pool: |
| 677 | |
| 678 | await pool.execute('CREATE TABLE exmany (a text, b int)') |
| 679 | try: |
| 680 | |
| 681 | coros = [worker(pool) for _ in range(N)] |
| 682 | res = await asyncio.gather(*coros) |
| 683 | self.assertEqual(res, [1] * N) |
| 684 | |
| 685 | n_rows = await pool.fetchval('SELECT count(*) FROM exmany') |
| 686 | self.assertEqual(n_rows, N * 4) |
| 687 | |
| 688 | finally: |
| 689 | await pool.execute('DROP TABLE exmany') |
| 690 | |
| 691 | async def test_pool_max_inactive_time_01(self): |
| 692 | async with self.create_pool( |
nothing calls this directly
no test coverage detected