From 59f9fc7cbf6ef032f91936a2d478b4e37f510ea3 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 10 Feb 2021 16:01:56 +0100 Subject: [PATCH] the test machinery is too stateful in waiting for account configure+start -- tests from deltabot got into a deadlock while setting up accounts. Be more specific with the "get online acocunt" helpers. --- python/src/deltachat/testplugin.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/python/src/deltachat/testplugin.py b/python/src/deltachat/testplugin.py index d0fa1250e..29f21bcdd 100644 --- a/python/src/deltachat/testplugin.py +++ b/python/src/deltachat/testplugin.py @@ -312,19 +312,19 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, data): def get_one_online_account(self, pre_generated_key=True, mvbox=False, move=False): ac1 = self.get_online_configuring_account( pre_generated_key=pre_generated_key, mvbox=mvbox, move=move) - self.wait_configure_and_start_io() + self.wait_configure_and_start_io([ac1]) return ac1 def get_two_online_accounts(self, move=False, quiet=False): ac1 = self.get_online_configuring_account(move=move, quiet=quiet) ac2 = self.get_online_configuring_account(quiet=quiet) - self.wait_configure_and_start_io() + self.wait_configure_and_start_io([ac1, ac2]) return ac1, ac2 def get_many_online_accounts(self, num, move=True): accounts = [self.get_online_configuring_account(move=move, quiet=True) for i in range(num)] - self.wait_configure_and_start_io() + self.wait_configure_and_start_io(accounts) for acc in accounts: acc.add_account_plugin(FFIEventLogger(acc)) return accounts @@ -356,16 +356,19 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, data): ac._configtracker = ac.configure() return ac - def wait_configure_and_start_io(self): + def wait_configure_and_start_io(self, accounts=None): + if accounts is None: + accounts = self._accounts[:] started_accounts = [] - for acc in self._accounts: - self.wait_configure(acc) - acc.set_config("bcc_self", "0") - if acc.is_configured() and acc not in started_accounts: - acc.start_io() - started_accounts.append(acc) - print("{}: {} account was successfully setup".format( - acc.get_config("displayname"), acc.get_config("addr"))) + for acc in accounts: + if acc not in started_accounts: + self.wait_configure(acc) + acc.set_config("bcc_self", "0") + if acc.is_configured(): + acc.start_io() + started_accounts.append(acc) + print("{}: {} account was started".format( + acc.get_config("displayname"), acc.get_config("addr"))) for acc in started_accounts: acc._evtracker.wait_all_initial_fetches()