diff --git a/python/src/deltachat/direct_imap.py b/python/src/deltachat/direct_imap.py index 3040d3861..0013f97ff 100644 --- a/python/src/deltachat/direct_imap.py +++ b/python/src/deltachat/direct_imap.py @@ -1,13 +1,4 @@ -import os -import threading -import click -import ssl -import atexit -import email -import contextlib -import time import imaplib -from subprocess import call INBOX = "Inbox" SENT = "Sent" @@ -25,6 +16,7 @@ def db_folder_attr(name): s.db_folder[name] = val return property(fget, fset, None, None) + class ImapConn(): def __init__(self, foldername, conn_info): self.foldername = foldername @@ -44,13 +36,12 @@ class ImapConn(): result, data = self.connection.search(None, 'UnSeen') try: mails_uid = data[0].split() - newest_mail = mails_uid[0] print("New mails") # self.connection.store(data[0].replace(' ',','),'+FLAGS','\Seen') for e_id in mails_uid: - self.connection.store(e_id, '+FLAGS', '\Seen') - print("marked:",e_id) + self.connection.store(e_id, '+FLAGS', '\\Seen') + print("marked:", e_id) return True except IndexError: diff --git a/python/tests/test_account.py b/python/tests/test_account.py index de1c5764f..c6176b23f 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -7,6 +7,9 @@ from deltachat import const, Account from deltachat.message import Message from deltachat.hookspec import account_hookimpl from datetime import datetime, timedelta +from conftest import (wait_configuration_progress, + wait_securejoin_inviter_progress) +from deltachat import direct_imap @pytest.mark.parametrize("msgtext,res", [ @@ -657,10 +660,10 @@ class TestOnlineAccount: assert list(ac2.get_fresh_messages()) - for i in range(0,30): + for i in range(0, 30): if imap2.get_unread_cnt() == 1: break - sleep(1) # We might need to wait because Imaplib is slower than DC-Core + time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core assert imap2.get_unread_cnt() == 1 incoming_on_ac2.mark_seen() @@ -670,10 +673,10 @@ class TestOnlineAccount: assert not list(ac2.get_fresh_messages()) # The new messages should be seen now. - for i in range(0,30): + for i in range(0, 30): if imap2.get_unread_cnt() == 0: break - sleep(1) # We might need to wait because Imaplib is slower than DC-Core + time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core assert imap2.get_unread_cnt() == 0 def test_send_file_twice_unicode_filename_mangling(self, tmpdir, acfactory, lp):