Skip to content

Self-hosted AI workspace.

Python

fix(tests): allow multiple logout calls when IMAP fallback reconnects (#1976)

raf3ebe335790e0
diff --git a/tests/test_email_polly_imap_leak.py b/tests/test_email_polly_imap_leak.py
index f7944444e..4811440f4 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."