diff --git a/test/miniimap.py b/test/miniimap.py index a4b0151..c5c80bc 100644 --- a/test/miniimap.py +++ b/test/miniimap.py @@ -7,7 +7,7 @@ from secrets import token_urlsafe try: import imap_settings as settings except: - raise ValueError("Imap settings file not found, please check the readme - miniimap") + raise ValueError("Imap settings file not found, please check the readme") def connect(): @@ -16,8 +16,8 @@ def connect(): server.login(settings.IMAP_USER, settings.IMAP_PWD) tmp, data = server.select('Inbox') - #When you connect to the inbox one of the parameters returned is the current - #number of messages in it + # When you connect to the inbox one of the parameters returned is the + # current number of messages in it if os.environ.get('NUMMESSAGES') is None: os.environ["NUMMESSAGES"] = data[0].decode("UTF-8") diff --git a/test/sync_handshake.py b/test/sync_handshake.py index 62253ed..9d69fdd 100644 --- a/test/sync_handshake.py +++ b/test/sync_handshake.py @@ -142,9 +142,6 @@ def shutdown_sync(): def run(name, color=None, imap=False, own_ident=1): - if imap: - import miniimap - import imap_settings global device_name device_name = name @@ -160,6 +157,9 @@ def run(name, color=None, imap=False, own_ident=1): pEp.debug_color(36) if imap: + import miniimap + import imap_settings + me = pEp.Identity(imap_settings.IMAP_EMAIL, name + " of " + imap_settings.IMAP_USER, name) pEp.myself(me) pEp.messageToSend = messageImapToSend diff --git a/test/sync_test.py b/test/sync_test.py index 6d0511e..28a3ddc 100644 --- a/test/sync_test.py +++ b/test/sync_test.py @@ -21,8 +21,6 @@ import pathlib def test_for(path, color=None, end_on=None, mt=False, imap=False): - if imap: - import miniimap cwd = os.getcwd(); os.chdir(path) @@ -106,6 +104,9 @@ if __name__ == "__main__": help="use imap instead of minimail") options, args = optParser.parse_args() + if options.imap: + import miniimap + if options.cleanall: options.clean = True @@ -133,7 +134,6 @@ if __name__ == "__main__": if options.third: setup("Pad") - elif options.backup: rmrf("Backup") @@ -147,6 +147,7 @@ if __name__ == "__main__": os.mkdir("Backup/TestInbox") except FileExistsError: pass + miniimap.backup_inbox() else: shutil.copytree("Phone", "Backup/Phone", symlinks=True, copy_function=shutil.copy2)