fix flaky test to not rely on timing

This commit is contained in:
holger krekel
2022-05-04 13:29:08 +02:00
parent 77498c17a5
commit 32a9db6922

View File

@@ -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