diff --git a/python/src/deltachat/direct_imap.py b/python/src/deltachat/direct_imap.py index 79a99cd38..2d86b9754 100644 --- a/python/src/deltachat/direct_imap.py +++ b/python/src/deltachat/direct_imap.py @@ -196,6 +196,7 @@ class DirectImap: raise TimeoutError if terminate: self.idle_done() + self.account.log("imap-direct: idle_check returned {!r}".format(res)) return res def idle_wait_for_seen(self): diff --git a/python/src/deltachat/events.py b/python/src/deltachat/events.py index ccc80a4ef..277d37f7d 100644 --- a/python/src/deltachat/events.py +++ b/python/src/deltachat/events.py @@ -86,11 +86,11 @@ class FFIEventTracker: if rex.match(ev.name): return ev - def get_info_matching(self, regex): - rex = re.compile("(?:{}).*".format(regex)) + def get_info_contains(self, regex): + rex = re.compile(regex) while 1: ev = self.get_matching("DC_EVENT_INFO") - if rex.match(ev.data2): + if rex.search(ev.data2): return ev def ensure_event_not_queued(self, event_name_regex): diff --git a/python/tests/test_account.py b/python/tests/test_account.py index a402cfc72..7e4f8c710 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -1551,21 +1551,23 @@ class TestOnlineAccount: acfactory.wait_configure_and_start_io() - imap = ac2.direct_imap - imap.idle_start() + imap2 = ac2.direct_imap + imap2.idle_start() lp.sec("ac1: create chat with ac2") chat1 = ac1.create_chat(ac2) ac2.create_chat(ac1) sent_msg = chat1.send_text("hello") - imap.idle_check(terminate=False) + imap2.idle_check(terminate=False) msg = ac2._evtracker.wait_next_incoming_message() assert msg.text == "hello" - imap.idle_check(terminate=True) - assert len(imap.get_all_messages()) == 0 + imap2.idle_check(terminate=True) + ac2._evtracker.get_info_contains("close/expunge succeeded") + + assert len(imap2.get_all_messages()) == 0 # Mark deleted message as seen and check that read receipt arrives msg.mark_seen()