python: fix more flaky tests

This change fixes test_immediate_autodelete and maybe other tests using
DirectImap.get_all_messages().
This commit is contained in:
Alexander Krotov
2020-08-08 23:03:59 +03:00
parent e081c8b9ff
commit 4f8e7e0166
2 changed files with 9 additions and 8 deletions

View File

@@ -108,6 +108,15 @@ class DirectImap:
def get_all_messages(self):
assert not self._idling
# Flush unsolicited responses. IMAPClient has problems
# dealing with them: https://github.com/mjs/imapclient/issues/334
# When this NOOP was introduced, next FETCH returned empty
# result instead of a single message, even though IMAP server
# can only return more untagged responses than required, not
# less.
self.conn.noop()
return self.conn.fetch(ALL, [FLAGS])
def get_unread_messages(self):

View File

@@ -1688,14 +1688,6 @@ class TestOnlineAccount:
lp.sec("imap2: test that only one message is left")
imap2 = ac2.direct_imap
# Flush unsolicited responses. IMAPClient has problems
# dealing with them: https://github.com/mjs/imapclient/issues/334
# When this NOOP was introduced, next FETCH returned empty
# result instead of a single message, even though IMAP server
# can only return more untagged responses than required, not
# less.
imap2.conn.noop()
assert len(imap2.get_all_messages()) == 1