diff --git a/python/src/deltachat/testplugin.py b/python/src/deltachat/testplugin.py index 334db8cb5..939e892e9 100644 --- a/python/src/deltachat/testplugin.py +++ b/python/src/deltachat/testplugin.py @@ -33,9 +33,6 @@ def pytest_addoption(parser): def pytest_configure(config): - config.addinivalue_line( - "markers", "ignored: Mark test as bing slow, skipped unless --ignored is used." - ) cfg = config.getoption('--liveconfig') if not cfg: cfg = os.getenv('DCC_NEW_TMP_EMAIL') diff --git a/python/tests/test_account.py b/python/tests/test_account.py index f8603f897..02b303889 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -637,83 +637,6 @@ class TestOnlineAccount: ev_msg = ac1_clone._evtracker.wait_next_messages_changed() assert ev_msg.text == msg_out.text - @pytest.mark.parametrize('i', range(30)) - def test_mark_read_on_server(self, acfactory, lp, i): - ac1 = acfactory.get_online_configuring_account() - ac2 = acfactory.get_online_configuring_account(mvbox=True, move=True) - - ac1.wait_configure_finish() - ac1.start_io() - ac2.wait_configure_finish() - ac2.start_io() - - imap2 = make_direct_imap(ac2, direct_imap.MVBOX) - # imap2.mark_all_read() - assert imap2.get_unread_cnt() == 0 - - chat = self.get_chat(ac1, ac2) - chat_on_ac2 = self.get_chat(ac2, ac1) - - chat.send_text("Text message") - - incoming_on_ac2 = ac2._evtracker.wait_next_incoming_message() - lp.sec("Incoming: "+incoming_on_ac2.text) - - assert list(ac2.get_fresh_messages()) - - for i in range(0, 20): - if imap2.get_unread_cnt() == 1: - break - time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core - assert imap2.get_unread_cnt() == 1 - - chat_on_ac2.mark_noticed() - incoming_on_ac2.mark_seen() - ac2._evtracker.wait_next_messages_changed() - - assert not list(ac2.get_fresh_messages()) - - # The new messages should be seen now. - for i in range(0, 20): - if imap2.get_unread_cnt() == 0: - break - time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core - assert imap2.get_unread_cnt() == 0 - - @pytest.mark.parametrize('i', range(30)) - def test_mark_bcc_read_on_server(self, acfactory, lp, i): - ac1 = acfactory.get_online_configuring_account(mvbox=True, move=True) - ac2 = acfactory.get_online_configuring_account() - - ac1.wait_configure_finish() - ac1.start_io() - ac2.wait_configure_finish() - ac2.start_io() - - imap1 = make_direct_imap(ac1, direct_imap.MVBOX) - imap1.mark_all_read() - assert imap1.get_unread_cnt() == 0 - - chat = self.get_chat(ac1, ac2) - - ac1.set_config("bcc_self", "1") - chat.send_text("Text message") - - ac1._evtracker.get_matching("DC_EVENT_SMTP_MESSAGE_SENT") - - for i in range(0, 20): - if imap1.get_new_email_cnt() == 1: - break - time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core - assert imap1.get_new_email_cnt() == 1 - - for i in range(0, 20): - if imap1.get_unread_cnt() == 0: - break - time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core - - assert imap1.get_unread_cnt() == 0 - def test_send_file_twice_unicode_filename_mangling(self, tmpdir, acfactory, lp): ac1, ac2 = acfactory.get_two_online_accounts() chat = self.get_chat(ac1, ac2) @@ -1813,3 +1736,84 @@ class TestOnlineConfigureFails: ac1._configtracker.wait_progress(0) ev = ac1._evtracker.get_matching("DC_EVENT_ERROR_NETWORK") assert "could not connect" in ev.data2.lower() + + +class TestDirectImap: + @pytest.mark.ignored + @pytest.mark.parametrize('i', range(30)) + def test_mark_read_on_server(self, acfactory, lp, i): + ac1 = acfactory.get_online_configuring_account() + ac2 = acfactory.get_online_configuring_account(mvbox=True, move=True) + + ac1.wait_configure_finish() + ac1.start_io() + ac2.wait_configure_finish() + ac2.start_io() + + imap2 = make_direct_imap(ac2, direct_imap.MVBOX) + # imap2.mark_all_read() + assert imap2.get_unread_cnt() == 0 + + chat = self.get_chat(ac1, ac2) + chat_on_ac2 = self.get_chat(ac2, ac1) + + chat.send_text("Text message") + + incoming_on_ac2 = ac2._evtracker.wait_next_incoming_message() + lp.sec("Incoming: "+incoming_on_ac2.text) + + assert list(ac2.get_fresh_messages()) + + for i in range(0, 20): + if imap2.get_unread_cnt() == 1: + break + time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core + assert imap2.get_unread_cnt() == 1 + + chat_on_ac2.mark_noticed() + incoming_on_ac2.mark_seen() + ac2._evtracker.wait_next_messages_changed() + + assert not list(ac2.get_fresh_messages()) + + # The new messages should be seen now. + for i in range(0, 20): + if imap2.get_unread_cnt() == 0: + break + time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core + assert imap2.get_unread_cnt() == 0 + + @pytest.mark.ignored + @pytest.mark.parametrize('i', range(30)) + def test_mark_bcc_read_on_server(self, acfactory, lp, i): + ac1 = acfactory.get_online_configuring_account(mvbox=True, move=True) + ac2 = acfactory.get_online_configuring_account() + + ac1.wait_configure_finish() + ac1.start_io() + ac2.wait_configure_finish() + ac2.start_io() + + imap1 = make_direct_imap(ac1, direct_imap.MVBOX) + imap1.mark_all_read() + assert imap1.get_unread_cnt() == 0 + + chat = self.get_chat(ac1, ac2) + + ac1.set_config("bcc_self", "1") + chat.send_text("Text message") + + ac1._evtracker.get_matching("DC_EVENT_SMTP_MESSAGE_SENT") + + for i in range(0, 20): + if imap1.get_new_email_cnt() == 1: + break + time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core + assert imap1.get_new_email_cnt() == 1 + + for i in range(0, 20): + if imap1.get_unread_cnt() == 0: + break + time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core + + assert imap1.get_unread_cnt() == 0 diff --git a/python/tox.ini b/python/tox.ini index 3309b08a3..91180223a 100644 --- a/python/tox.ini +++ b/python/tox.ini @@ -71,6 +71,8 @@ norecursedirs = .tox xfail_strict=true timeout = 90 timeout_method = thread +markers = + ignored: ignore this test in default test runs, use --ignored to run. [flake8] max-line-length = 120