MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_pool_01

Method test_pool_01

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

Source from the content-addressed store, hash-verified

56 await asyncio.wait_for(wait(), 5)
57
58 async def test_pool_01(self):
59 for n in {1, 5, 10, 20, 100}:
60 with self.subTest(tasksnum=n):
61 pool = await self.create_pool(database='postgres',
62 init_size=5,
63 min_size=1,
64 max_size=10)
65
66 async def worker():
67 con = await pool.acquire()
68 self.assertEqual(await con.fetchval('SELECT 1'), 1)
69 await pool.release(con)
70
71 tasks = [worker() for _ in range(n)]
72 await asyncio.gather(*tasks)
73 await pool.close()
74
75 async def test_pool_02(self):
76 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