| 100 | del con |
| 101 | |
| 102 | async def test_pool_04(self): |
| 103 | pool = await self.create_pool(database='postgres', |
| 104 | init_size=1, min_size=1, max_size=1) |
| 105 | |
| 106 | con = await pool.acquire(timeout=POOL_NOMINAL_TIMEOUT) |
| 107 | |
| 108 | # Manual termination of pool connections releases the |
| 109 | # pool item immediately. |
| 110 | con.terminate() |
| 111 | self.assertIsNone(pool._holders[0]._con) |
| 112 | self.assertIsNone(pool._holders[0]._in_use) |
| 113 | |
| 114 | con = await pool.acquire(timeout=POOL_NOMINAL_TIMEOUT) |
| 115 | self.assertEqual(await con.fetchval('SELECT 1'), 1) |
| 116 | |
| 117 | await con.close() |
| 118 | self.assertIsNone(pool._holders[0]._con) |
| 119 | self.assertIsNone(pool._holders[0]._in_use) |
| 120 | # Calling release should not hurt. |
| 121 | await pool.release(con) |
| 122 | |
| 123 | pool.terminate() |
| 124 | |
| 125 | async def test_pool_05(self): |
| 126 | for n in {1, 3, 5, 10, 20, 100}: |