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

Method _test_pool

tests/test_connect.py:2106–2121  ·  view source on GitHub ↗
(self, *, expected_ssl, **conn_args)

Source from the content-addressed store, hash-verified

2104 self.assertEqual(await con.fetchval('SELECT 43'), 43)
2105
2106 async def _test_pool(self, *, expected_ssl, **conn_args):
2107 pool = await self.create_pool(min_size=5, max_size=10, **conn_args)
2108
2109 async def worker():
2110 async with pool.acquire() as con:
2111 self.assertEqual(con._protocol.is_ssl, expected_ssl)
2112 await self._test_cancellation_recovery(con)
2113
2114 tasks = [self.loop.create_task(worker()) for _ in range(100)]
2115 try:
2116 await asyncio.gather(*tasks)
2117 finally:
2118 for task in tasks:
2119 task.cancel()
2120 await asyncio.gather(*tasks, return_exceptions=True)
2121 await pool.close()
2122
2123 async def _test_sslmode_works(
2124 self, sslmode, *, expected_ssl, host='localhost',

Callers 2

Calls 3

create_poolMethod · 0.45
cancelMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected