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.
This commit is contained in:
raf 2026-06-04 09:56:05 +08:00 committed by GitHub
parent 82fcec6bb6
commit 2efebcc278
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,8 +100,8 @@ async def test_auto_summarize_pass_logs_out_imap_on_select_failure(monkeypatch):
assert captured.get("connect_called") is True, ( assert captured.get("connect_called") is True, (
"test setup: _imap_connect must be reached for the leak to apply" "test setup: _imap_connect must be reached for the leak to apply"
) )
assert captured.get("logout_calls", 0) == 1, ( assert captured.get("logout_calls", 0) >= 1, (
f"conn.logout() must be called exactly once on the error path " 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"(IMAP leak fix). Got logout_calls={captured.get('logout_calls')}, "
f"select_calls={captured.get('select_calls')}. Pre-fix the " f"select_calls={captured.get('select_calls')}. Pre-fix the "
f"outer `except` returned without logging out the IMAP socket." f"outer `except` returned without logging out the IMAP socket."