(self)
| 876 | self.assertEqual(pool.get_size(), 1) |
| 877 | |
| 878 | async def test_pool_shutdown_cleans_idle_connections(self): |
| 879 | class WeakPool(pg_pool.Pool): |
| 880 | pass |
| 881 | |
| 882 | for action in ('close', 'terminate'): |
| 883 | for floor in (0, 1): |
| 884 | with self.subTest(action=action, floor=floor): |
| 885 | pool = await tb.create_pool( |
| 886 | **self.get_connection_spec(), pool_class=WeakPool, |
| 887 | init_size=1, min_size=floor, max_size=1, |
| 888 | max_inactive_connection_lifetime=0.05, |
| 889 | ) |
| 890 | try: |
| 891 | if action == 'close': |
| 892 | await pool.close() |
| 893 | else: |
| 894 | pool.terminate() |
| 895 | self.assertIsNone(pool._holders[0]._con) |
| 896 | self.assertIsNone(pool._holders[0]._inactive_callback) |
| 897 | finally: |
| 898 | pool.terminate() |
| 899 | |
| 900 | ref = weakref.ref(pool) |
| 901 | del pool |
| 902 | gc.collect() |
| 903 | self.assertIsNone(ref()) |
| 904 | |
| 905 | async def test_pool_gc_does_not_restore_min_size(self): |
| 906 | for inactive_timeout in (0, 0.05): |
nothing calls this directly
no test coverage detected