(self)
| 224 | self.assertEqual(0, len(cx_pool.conns)) |
| 225 | |
| 226 | def test_pool_removes_dead_socket(self): |
| 227 | # Test that Pool removes dead socket and the socket doesn't return |
| 228 | # itself PYTHON-344 |
| 229 | cx_pool = self.create_pool(max_pool_size=1, wait_queue_timeout=1) |
| 230 | cx_pool._check_interval_seconds = 0 # Always check. |
| 231 | |
| 232 | with cx_pool.checkout() as conn: |
| 233 | # Simulate a closed socket without telling the Connection it's |
| 234 | # closed. |
| 235 | conn.conn.close() |
| 236 | self.assertTrue(conn.conn_closed()) |
| 237 | |
| 238 | with cx_pool.checkout() as new_connection: |
| 239 | self.assertEqual(0, len(cx_pool.conns)) |
| 240 | self.assertNotEqual(conn, new_connection) |
| 241 | |
| 242 | self.assertEqual(1, len(cx_pool.conns)) |
| 243 | |
| 244 | # Semaphore was released. |
| 245 | with cx_pool.checkout(): |
| 246 | pass |
| 247 | |
| 248 | def test_socket_closed(self): |
| 249 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
nothing calls this directly
no test coverage detected