clean code sync imap
authorDavid
Fri, 29 Nov 2019 15:22:51 +0100
branchsync
changeset 32773fb320d8785
parent 326 fd352bce99dd
child 328 9d688fdef3de
clean code
test/miniimap.py
test/sync_handshake.py
test/sync_test.py
     1.1 --- a/test/miniimap.py	Thu Nov 28 16:42:09 2019 +0100
     1.2 +++ b/test/miniimap.py	Fri Nov 29 15:22:51 2019 +0100
     1.3 @@ -7,7 +7,7 @@
     1.4  try:
     1.5      import imap_settings as settings
     1.6  except:
     1.7 -    raise ValueError("Imap settings file not found, please check the readme - miniimap")
     1.8 +    raise ValueError("Imap settings file not found, please check the readme")
     1.9  
    1.10  
    1.11  def connect():
    1.12 @@ -16,8 +16,8 @@
    1.13      server.login(settings.IMAP_USER, settings.IMAP_PWD)
    1.14      tmp, data = server.select('Inbox')
    1.15  
    1.16 -    #When you connect to the inbox one of the parameters returned is the current
    1.17 -    #number of messages in it
    1.18 +    # When you connect to the inbox one of the parameters returned is the
    1.19 +    # current number of messages in it
    1.20      if os.environ.get('NUMMESSAGES') is None:
    1.21          os.environ["NUMMESSAGES"] = data[0].decode("UTF-8")
    1.22  
     2.1 --- a/test/sync_handshake.py	Thu Nov 28 16:42:09 2019 +0100
     2.2 +++ b/test/sync_handshake.py	Fri Nov 29 15:22:51 2019 +0100
     2.3 @@ -142,9 +142,6 @@
     2.4  
     2.5  
     2.6  def run(name, color=None, imap=False, own_ident=1):
     2.7 -    if imap:
     2.8 -        import miniimap
     2.9 -        import imap_settings
    2.10  
    2.11      global device_name
    2.12      device_name = name
    2.13 @@ -160,6 +157,9 @@
    2.14              pEp.debug_color(36)
    2.15  
    2.16      if imap:
    2.17 +        import miniimap
    2.18 +        import imap_settings
    2.19 +        
    2.20          me = pEp.Identity(imap_settings.IMAP_EMAIL, name + " of " + imap_settings.IMAP_USER, name)
    2.21          pEp.myself(me)
    2.22          pEp.messageToSend = messageImapToSend
     3.1 --- a/test/sync_test.py	Thu Nov 28 16:42:09 2019 +0100
     3.2 +++ b/test/sync_test.py	Fri Nov 29 15:22:51 2019 +0100
     3.3 @@ -21,8 +21,6 @@
     3.4  
     3.5  
     3.6  def test_for(path, color=None, end_on=None, mt=False, imap=False):
     3.7 -    if imap:
     3.8 -        import miniimap
     3.9  
    3.10      cwd = os.getcwd();
    3.11      os.chdir(path)
    3.12 @@ -106,6 +104,9 @@
    3.13              help="use imap instead of minimail")
    3.14      options, args = optParser.parse_args()
    3.15  
    3.16 +    if options.imap:
    3.17 +        import miniimap
    3.18 +
    3.19      if options.cleanall:
    3.20          options.clean = True
    3.21  
    3.22 @@ -133,7 +134,6 @@
    3.23                  if options.third:
    3.24                      setup("Pad")
    3.25  
    3.26 -
    3.27      elif options.backup:
    3.28          rmrf("Backup")
    3.29  
    3.30 @@ -147,6 +147,7 @@
    3.31                  os.mkdir("Backup/TestInbox")
    3.32              except FileExistsError:
    3.33                  pass
    3.34 +
    3.35              miniimap.backup_inbox()
    3.36          else:
    3.37              shutil.copytree("Phone", "Backup/Phone", symlinks=True, copy_function=shutil.copy2)