diff --git a/python/src/deltachat/account.py b/python/src/deltachat/account.py index 8a861d263..bf399c2de 100644 --- a/python/src/deltachat/account.py +++ b/python/src/deltachat/account.py @@ -38,7 +38,7 @@ class Account(object): # initialize per-account plugin system self._pm = hookspec.PerAccount._make_plugin_manager() self._logging = logging - self.logid=logid + self.logid = logid self.add_account_plugin(self) @@ -631,7 +631,7 @@ class Account(object): hook = hookspec.Global._get_plugin_manager().hook hook.dc_account_after_shutdown(account=self) self.log("shutdown finished") - + class ScannedQRCode: def __init__(self, dc_lot): diff --git a/python/src/deltachat/direct_imap.py b/python/src/deltachat/direct_imap.py index bfcd6af14..845f915d3 100644 --- a/python/src/deltachat/direct_imap.py +++ b/python/src/deltachat/direct_imap.py @@ -29,7 +29,7 @@ class ImapConn(): messages = self.reselect_folder() try: self.original_msg_count = int(messages[0]) - print("dbg", str(messages)) + print("dbg", str(messages)) except IndexError: self.original_msg_count = 0 @@ -80,13 +80,13 @@ class ImapConn(): def __del__(self): try: self.connection.close() - except: - pass + except Exception: + print("Could not close direct_imap conn") try: self.connection.logout() - except: - pass - + except Exception: + print("Could not logout direct_imap conn") + def make_direct_imap(account, folder): conn_info = (account.get_config("configured_mail_server"), @@ -94,9 +94,11 @@ def make_direct_imap(account, folder): imap = ImapConn(folder, conn_info=conn_info) return imap + def print_imap_structure(database, dir="."): print_imap_structure_ac(Account(database), dir) + def print_imap_structure_ac(ac, dir="."): acinfo = ac.logid + "-" + ac.get_config("addr") print("================= ACCOUNT", acinfo, "=================") diff --git a/python/src/deltachat/testplugin.py b/python/src/deltachat/testplugin.py index 9495396dc..334db8cb5 100644 --- a/python/src/deltachat/testplugin.py +++ b/python/src/deltachat/testplugin.py @@ -17,8 +17,6 @@ from .capi import lib from .events import FFIEventLogger, FFIEventTracker from _pytest._code import Source -from .direct_imap import ImapConn - import deltachat diff --git a/python/tests/test_account.py b/python/tests/test_account.py index c1fe6d4c1..87d70af49 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -647,7 +647,7 @@ class TestOnlineAccount: ac2.start_io() imap2 = make_direct_imap(ac2, direct_imap.MVBOX) - #imap2.mark_all_read() + # imap2.mark_all_read() assert imap2.get_unread_cnt() == 0 chat = self.get_chat(ac1, ac2) @@ -679,8 +679,6 @@ class TestOnlineAccount: time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core assert imap2.get_unread_cnt() == 0 - #print_imap_structure(ac1.db_path) - def test_mark_bcc_read_on_server(self, acfactory, lp): ac1 = acfactory.get_online_configuring_account(mvbox=True, move=True) ac2 = acfactory.get_online_configuring_account() @@ -691,7 +689,7 @@ class TestOnlineAccount: ac2.start_io() imap1 = make_direct_imap(ac1, direct_imap.MVBOX) - #imap1.mark_all_read() + # imap1.mark_all_read() assert imap1.get_unread_cnt() == 0 chat = self.get_chat(ac1, ac2) @@ -712,8 +710,6 @@ class TestOnlineAccount: break time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core - #print_imap_structure(ac1.db_path) - assert imap1.get_unread_cnt() == 0 def test_send_file_twice_unicode_filename_mangling(self, tmpdir, acfactory, lp):