From 32a9db6922cba6fa6dacdd48b5fd7b75e2ce085b Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 4 May 2022 13:29:08 +0200 Subject: [PATCH] fix flaky test to not rely on timing --- python/tests/test_4_lowlevel.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/python/tests/test_4_lowlevel.py b/python/tests/test_4_lowlevel.py index 17d7de99f..efede80b8 100644 --- a/python/tests/test_4_lowlevel.py +++ b/python/tests/test_4_lowlevel.py @@ -157,20 +157,19 @@ def test_logged_hook_failure(acfactory): def test_logged_ac_process_ffi_failure(acfactory): from deltachat import account_hookimpl - ac1 = acfactory.get_unconfigured_account() - acfactory._acsetup.init_logging(ac1) + ac1 = acfactory.get_pseudo_configured_account() class FailPlugin: @account_hookimpl def ac_process_ffi_event(ffi_event): 0/0 + cap = Queue() + ac1.log = cap.put ac1.add_account_plugin(FailPlugin()) - cap = [] - ac1.log = cap.append # cause any event eg contact added/changed ac1.create_contact("something@example.org") - assert cap - assert "ac_process_ffi_event" in str(cap) - assert "ZeroDivisionError" in str(cap) - assert "Traceback" in str(cap) + res = cap.get(timeout=10) + assert "ac_process_ffi_event" in res + assert "ZeroDivisionError" in res + assert "Traceback" in res