From 2efebcc2784530f390ac503e8b45aa057ffe745e Mon Sep 17 00:00:00 2001 From: raf <146721410+rafdog1222@users.noreply.github.com> Date: Thu, 4 Jun 2026 09:56:05 +0800 Subject: [PATCH] fix(tests): allow multiple logout calls when IMAP fallback reconnects (#1976) _latest_inbox_fallback_uids logs out the broken connection before reconnecting. The outer finally then logs out the new connection. Both logouts are correct, the test assertion of == 1 was written before the reconnect logic existed. Changed to >= 1. --- tests/test_email_polly_imap_leak.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_email_polly_imap_leak.py b/tests/test_email_polly_imap_leak.py index f794444..4811440 100644 --- a/tests/test_email_polly_imap_leak.py +++ b/tests/test_email_polly_imap_leak.py @@ -100,8 +100,8 @@ async def test_auto_summarize_pass_logs_out_imap_on_select_failure(monkeypatch): assert captured.get("connect_called") is True, ( "test setup: _imap_connect must be reached for the leak to apply" ) - assert captured.get("logout_calls", 0) == 1, ( - f"conn.logout() must be called exactly once on the error path " + assert captured.get("logout_calls", 0) >= 1, ( + f"conn.logout() must be called at least once on the error path " f"(IMAP leak fix). Got logout_calls={captured.get('logout_calls')}, " f"select_calls={captured.get('select_calls')}. Pre-fix the " f"outer `except` returned without logging out the IMAP socket."