From 0a2200c2c81cf5d9bbc13a3b2220740ad71471e8 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Tue, 28 Mar 2023 11:16:08 -0300 Subject: [PATCH] python: Wait for initial Resync in the bot tests --- python/examples/test_examples.py | 6 +++++- python/src/deltachat/testplugin.py | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/python/examples/test_examples.py b/python/examples/test_examples.py index e6b2d53f4..6e4f6ef25 100644 --- a/python/examples/test_examples.py +++ b/python/examples/test_examples.py @@ -24,6 +24,8 @@ def test_echo_quit_plugin(acfactory, lp): lp.sec("creating a temp account to contact the bot") (ac1,) = acfactory.get_online_accounts(1) + botproc.await_resync() + lp.sec("sending a message to the bot") bot_contact = ac1.create_contact(botproc.addr) bot_chat = bot_contact.create_chat() @@ -40,7 +42,7 @@ def test_echo_quit_plugin(acfactory, lp): def test_group_tracking_plugin(acfactory, lp): lp.sec("creating one group-tracking bot and two temp accounts") - botproc = acfactory.run_bot_process(group_tracking, ffi=False) + botproc = acfactory.run_bot_process(group_tracking) ac1, ac2 = acfactory.get_online_accounts(2) @@ -52,6 +54,8 @@ def test_group_tracking_plugin(acfactory, lp): ac1.add_account_plugin(FFIEventLogger(ac1)) ac2.add_account_plugin(FFIEventLogger(ac2)) + botproc.await_resync() + lp.sec("creating bot test group with bot") bot_contact = ac1.create_contact(botproc.addr) ch = ac1.create_group_chat("bot test group") diff --git a/python/src/deltachat/testplugin.py b/python/src/deltachat/testplugin.py index fd6b06ac2..192afb508 100644 --- a/python/src/deltachat/testplugin.py +++ b/python/src/deltachat/testplugin.py @@ -676,6 +676,13 @@ class BotProcess: print("+++IGN:", line) ignored.append(line) + def await_resync(self): + self.fnmatch_lines( + """ + *Resync: collected * message IDs in folder INBOX* + """, + ) + @pytest.fixture() def tmp_db_path(tmpdir):