From f13a1d4a2f7f399246be584360de681900f349ba Mon Sep 17 00:00:00 2001 From: holger krekel Date: Fri, 19 Jul 2019 22:46:58 +0200 Subject: [PATCH] fix some test flakyness --- python/src/deltachat/__init__.py | 6 ++++-- python/tests/test_increation.py | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/python/src/deltachat/__init__.py b/python/src/deltachat/__init__.py index e5612b827..bec169890 100644 --- a/python/src/deltachat/__init__.py +++ b/python/src/deltachat/__init__.py @@ -61,8 +61,10 @@ def set_context_callback(dc_context, func): def clear_context_callback(dc_context): - _DC_CALLBACK_MAP.pop(dc_context, None) - + try: + _DC_CALLBACK_MAP.pop(dc_context, None) + except AttributeError: + pass def get_dc_event_name(integer, _DC_EVENTNAME_MAP={}): if not _DC_EVENTNAME_MAP: diff --git a/python/tests/test_increation.py b/python/tests/test_increation.py index 095a9592b..b7181e2b4 100644 --- a/python/tests/test_increation.py +++ b/python/tests/test_increation.py @@ -32,7 +32,11 @@ class TestInCreation: chat2.add_contact(c2) wait_msgs_changed(ac1, 0, 0) # why not chat id? ac1.forward_messages([prepared_original], chat2) + # XXX there might be two EVENT_MSGS_CHANGED and only one of them + # is the one caused by forwarding forwarded_id = wait_msgs_changed(ac1, chat2.id) + if forwarded_id == 0: + forwarded_id = wait_msgs_changed(ac1, chat2.id) forwarded_msg = ac1.get_message_by_id(forwarded_id) assert forwarded_msg.get_state().is_out_preparing()