MCPcopy
hub / github.com/MagicStack/asyncpg / test_pool_01

Method test_pool_01

tests/test_pool.py:46–59  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

44class TestPool(tb.ConnectedTestCase):
45
46 async def test_pool_01(self):
47 for n in {1, 5, 10, 20, 100}:
48 with self.subTest(tasksnum=n):
49 pool = await self.create_pool(database='postgres',
50 min_size=5, max_size=10)
51
52 async def worker():
53 con = await pool.acquire()
54 self.assertEqual(await con.fetchval('SELECT 1'), 1)
55 await pool.release(con)
56
57 tasks = [worker() for _ in range(n)]
58 await asyncio.gather(*tasks)
59 await pool.close()
60
61 async def test_pool_02(self):
62 for n in {1, 3, 5, 10, 20, 100}:

Callers

nothing calls this directly

Calls 2

create_poolMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected