()
| 72 | |
| 73 | @pytest.mark.asyncio |
| 74 | async def test_get_expired(): |
| 75 | # Use a short max duration to simulate expiration. |
| 76 | dummy_connect = dummy_connect_factory() |
| 77 | pool = ConnectionPool(max_session_duration=1, connect_cb=dummy_connect) |
| 78 | |
| 79 | conn = await pool.get(timeout=10.0) |
| 80 | pool.put(conn) |
| 81 | # Artificially set the connection's timestamp in the past to simulate expiration. |
| 82 | pool._connections[conn] = time.time() - 2 # 2 seconds ago (max_session_duration is 1) |
| 83 | |
| 84 | conn2 = await pool.get(timeout=10.0) |
| 85 | assert conn2 is not conn, "Expected a new connection to be returned." |
nothing calls this directly
no test coverage detected