mirror of
https://github.com/chatmail/core.git
synced 2026-05-21 15:56:30 +03:00
Remove .wait_for_seen() calls in flaky tests
This is a merge commit for <https://github.com/deltachat/deltachat-core-rust/pull/4226>
This commit is contained in:
@@ -220,16 +220,16 @@ def test_fetch_existing(acfactory, lp, mvbox_move):
|
|||||||
acfactory.bring_accounts_online()
|
acfactory.bring_accounts_online()
|
||||||
assert_folders_configured(ac1)
|
assert_folders_configured(ac1)
|
||||||
|
|
||||||
assert ac1.direct_imap.select_config_folder("mvbox" if mvbox_move else "inbox")
|
lp.sec("send out message with bcc to ourselves")
|
||||||
with ac1.direct_imap.idle() as idle1:
|
ac1.set_config("bcc_self", "1")
|
||||||
lp.sec("send out message with bcc to ourselves")
|
chat = acfactory.get_accepted_chat(ac1, ac2)
|
||||||
ac1.set_config("bcc_self", "1")
|
chat.send_text("message text")
|
||||||
chat = acfactory.get_accepted_chat(ac1, ac2)
|
|
||||||
chat.send_text("message text")
|
|
||||||
assert_folders_configured(ac1)
|
|
||||||
|
|
||||||
lp.sec("wait until the bcc_self message arrives in correct folder and is marked seen")
|
lp.sec("wait until the bcc_self message arrives in correct folder and is marked seen")
|
||||||
assert idle1.wait_for_seen()
|
if mvbox_move:
|
||||||
|
ac1._evtracker.get_info_contains("Marked messages [0-9]+ in folder DeltaChat as seen.")
|
||||||
|
else:
|
||||||
|
ac1._evtracker.get_info_contains("Marked messages [0-9]+ in folder INBOX as seen.")
|
||||||
assert_folders_configured(ac1)
|
assert_folders_configured(ac1)
|
||||||
|
|
||||||
lp.sec("create a cloned ac1 and fetch contact history during configure")
|
lp.sec("create a cloned ac1 and fetch contact history during configure")
|
||||||
@@ -271,12 +271,12 @@ def test_fetch_existing_msgs_group_and_single(acfactory, lp):
|
|||||||
ac1._evtracker.wait_next_incoming_message()
|
ac1._evtracker.wait_next_incoming_message()
|
||||||
|
|
||||||
lp.sec("send out message with bcc to ourselves")
|
lp.sec("send out message with bcc to ourselves")
|
||||||
with ac1.direct_imap.idle() as idle1:
|
ac1.set_config("bcc_self", "1")
|
||||||
ac1.set_config("bcc_self", "1")
|
ac1_ac2_chat = ac1.create_chat(ac2)
|
||||||
ac1_ac2_chat = ac1.create_chat(ac2)
|
ac1_ac2_chat.send_text("outgoing, encrypted direct message, creating a chat")
|
||||||
ac1_ac2_chat.send_text("outgoing, encrypted direct message, creating a chat")
|
|
||||||
# wait until the bcc_self message arrives
|
# wait until the bcc_self message arrives
|
||||||
assert idle1.wait_for_seen()
|
ac1._evtracker.get_info_contains("Marked messages [0-9]+ in folder INBOX as seen.")
|
||||||
|
|
||||||
lp.sec("Clone online account and let it fetch the existing messages")
|
lp.sec("Clone online account and let it fetch the existing messages")
|
||||||
ac1_clone = acfactory.new_online_configuring_account(cloned_from=ac1)
|
ac1_clone = acfactory.new_online_configuring_account(cloned_from=ac1)
|
||||||
|
|||||||
@@ -518,22 +518,22 @@ def test_send_and_receive_message_markseen(acfactory, lp):
|
|||||||
msg4 = ac2._evtracker.wait_next_incoming_message()
|
msg4 = ac2._evtracker.wait_next_incoming_message()
|
||||||
|
|
||||||
lp.sec("mark messages as seen on ac2, wait for changes on ac1")
|
lp.sec("mark messages as seen on ac2, wait for changes on ac1")
|
||||||
with ac1.direct_imap.idle() as idle1:
|
ac2.mark_seen_messages([msg2, msg4])
|
||||||
with ac2.direct_imap.idle() as idle2:
|
ev = ac2._evtracker.get_matching("DC_EVENT_MSGS_NOTICED")
|
||||||
ac2.mark_seen_messages([msg2, msg4])
|
assert msg2.chat.id == msg4.chat.id
|
||||||
ev = ac2._evtracker.get_matching("DC_EVENT_MSGS_NOTICED")
|
assert ev.data1 == msg2.chat.id
|
||||||
assert msg2.chat.id == msg4.chat.id
|
assert ev.data2 == 0
|
||||||
assert ev.data1 == msg2.chat.id
|
ac2._evtracker.get_info_contains("Marked messages .* in folder INBOX as seen.")
|
||||||
assert ev.data2 == 0
|
|
||||||
idle2.wait_for_seen()
|
|
||||||
|
|
||||||
lp.step("1")
|
lp.step("1")
|
||||||
for _i in range(2):
|
for _i in range(2):
|
||||||
ev = ac1._evtracker.get_matching("DC_EVENT_MSG_READ")
|
ev = ac1._evtracker.get_matching("DC_EVENT_MSG_READ")
|
||||||
assert ev.data1 > const.DC_CHAT_ID_LAST_SPECIAL
|
assert ev.data1 > const.DC_CHAT_ID_LAST_SPECIAL
|
||||||
assert ev.data2 > const.DC_MSG_ID_LAST_SPECIAL
|
assert ev.data2 > const.DC_MSG_ID_LAST_SPECIAL
|
||||||
lp.step("2")
|
lp.step("2")
|
||||||
idle1.wait_for_seen() # Check that ac1 marks the read receipt as read
|
|
||||||
|
# Check that ac1 marks the read receipt as read.
|
||||||
|
ac1._evtracker.get_info_contains("Marked messages .* in folder INBOX as seen.")
|
||||||
|
|
||||||
assert msg1.is_out_mdn_received()
|
assert msg1.is_out_mdn_received()
|
||||||
assert msg3.is_out_mdn_received()
|
assert msg3.is_out_mdn_received()
|
||||||
@@ -618,18 +618,24 @@ def test_markseen_message_and_mdn(acfactory, mvbox_move):
|
|||||||
# Do not send BCC to self, we only want to test MDN on ac1.
|
# Do not send BCC to self, we only want to test MDN on ac1.
|
||||||
ac1.set_config("bcc_self", "0")
|
ac1.set_config("bcc_self", "0")
|
||||||
|
|
||||||
|
acfactory.get_accepted_chat(ac1, ac2).send_text("hi")
|
||||||
|
msg = ac2._evtracker.wait_next_incoming_message()
|
||||||
|
|
||||||
|
ac2.mark_seen_messages([msg])
|
||||||
|
|
||||||
folder = "mvbox" if mvbox_move else "inbox"
|
folder = "mvbox" if mvbox_move else "inbox"
|
||||||
|
for ac in [ac1, ac2]:
|
||||||
|
if mvbox_move:
|
||||||
|
ac._evtracker.get_info_contains("Marked messages [0-9]+ in folder DeltaChat as seen.")
|
||||||
|
else:
|
||||||
|
ac._evtracker.get_info_contains("Marked messages [0-9]+ in folder INBOX as seen.")
|
||||||
ac1.direct_imap.select_config_folder(folder)
|
ac1.direct_imap.select_config_folder(folder)
|
||||||
ac2.direct_imap.select_config_folder(folder)
|
ac2.direct_imap.select_config_folder(folder)
|
||||||
with ac1.direct_imap.idle() as idle1:
|
|
||||||
with ac2.direct_imap.idle() as idle2:
|
|
||||||
acfactory.get_accepted_chat(ac1, ac2).send_text("hi")
|
|
||||||
msg = ac2._evtracker.wait_next_incoming_message()
|
|
||||||
|
|
||||||
ac2.mark_seen_messages([msg])
|
# Check that the mdn is marked as seen
|
||||||
|
assert len(list(ac1.direct_imap.conn.fetch(AND(seen=True)))) == 1
|
||||||
idle2.wait_for_seen() # Check original message is marked as seen
|
# Check original message is marked as seen
|
||||||
idle1.wait_for_seen() # Check that the mdn is marked as seen
|
assert len(list(ac2.direct_imap.conn.fetch(AND(seen=True)))) == 1
|
||||||
|
|
||||||
|
|
||||||
def test_reply_privately(acfactory):
|
def test_reply_privately(acfactory):
|
||||||
@@ -683,23 +689,24 @@ def test_mdn_asymmetric(acfactory, lp):
|
|||||||
|
|
||||||
assert len(msg.chat.get_messages()) == 1
|
assert len(msg.chat.get_messages()) == 1
|
||||||
|
|
||||||
ac1.direct_imap.select_config_folder("mvbox")
|
lp.sec("ac2: mark incoming message as seen")
|
||||||
with ac1.direct_imap.idle() as idle1:
|
ac2.mark_seen_messages([msg])
|
||||||
lp.sec("ac2: mark incoming message as seen")
|
|
||||||
ac2.mark_seen_messages([msg])
|
|
||||||
|
|
||||||
lp.sec("ac1: waiting for incoming activity")
|
lp.sec("ac1: waiting for incoming activity")
|
||||||
# MDN should be moved even though MDNs are already disabled
|
# MDN should be moved even though MDNs are already disabled
|
||||||
ac1._evtracker.get_matching("DC_EVENT_IMAP_MESSAGE_MOVED")
|
ac1._evtracker.get_matching("DC_EVENT_IMAP_MESSAGE_MOVED")
|
||||||
|
|
||||||
assert len(chat.get_messages()) == 1
|
assert len(chat.get_messages()) == 1
|
||||||
|
|
||||||
# Wait for the message to be marked as seen on IMAP.
|
# Wait for the message to be marked as seen on IMAP.
|
||||||
assert idle1.wait_for_seen()
|
ac1._evtracker.get_info_contains("Marked messages 1 in folder DeltaChat as seen.")
|
||||||
|
|
||||||
# MDN is received even though MDNs are already disabled
|
# MDN is received even though MDNs are already disabled
|
||||||
assert msg_out.is_out_mdn_received()
|
assert msg_out.is_out_mdn_received()
|
||||||
|
|
||||||
|
ac1.direct_imap.select_config_folder("mvbox")
|
||||||
|
assert len(list(ac1.direct_imap.conn.fetch(AND(seen=True)))) == 1
|
||||||
|
|
||||||
|
|
||||||
def test_send_and_receive_will_encrypt_decrypt(acfactory, lp):
|
def test_send_and_receive_will_encrypt_decrypt(acfactory, lp):
|
||||||
ac1, ac2 = acfactory.get_online_accounts(2)
|
ac1, ac2 = acfactory.get_online_accounts(2)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ envlist =
|
|||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands =
|
commands =
|
||||||
pytest -n6 --extra-info --reruns 2 --reruns-delay 5 -v -rsXx --ignored --strict-tls {posargs: tests examples}
|
pytest -n6 --extra-info -v -rsXx --ignored --strict-tls {posargs: tests examples}
|
||||||
pip wheel . -w {toxworkdir}/wheelhouse --no-deps
|
pip wheel . -w {toxworkdir}/wheelhouse --no-deps
|
||||||
setenv =
|
setenv =
|
||||||
# Avoid stack overflow when Rust core is built without optimizations.
|
# Avoid stack overflow when Rust core is built without optimizations.
|
||||||
@@ -21,7 +21,6 @@ passenv =
|
|||||||
RUSTC_WRAPPER
|
RUSTC_WRAPPER
|
||||||
deps =
|
deps =
|
||||||
pytest
|
pytest
|
||||||
pytest-rerunfailures
|
|
||||||
pytest-timeout
|
pytest-timeout
|
||||||
pytest-xdist
|
pytest-xdist
|
||||||
pdbpp
|
pdbpp
|
||||||
|
|||||||
Reference in New Issue
Block a user