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

Method test_pool_02

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

Source from the content-addressed store, hash-verified

73 await pool.close()
74
75 async def test_pool_02(self):
76 for n in {1, 3, 5, 10, 20, 100}:
77 with self.subTest(tasksnum=n):
78 async with self.create_pool(database='postgres',
79 init_size=5,
80 min_size=1,
81 max_size=5) as pool:
82
83 async def worker():
84 con = await pool.acquire(timeout=5)
85 self.assertEqual(await con.fetchval('SELECT 1'), 1)
86 await pool.release(con)
87
88 tasks = [worker() for _ in range(n)]
89 await asyncio.gather(*tasks)
90
91 async def test_pool_03(self):
92 pool = await self.create_pool(database='postgres',

Callers

nothing calls this directly

Calls 1

create_poolMethod · 0.45

Tested by

no test coverage detected