From 6ab67b4c69be4d3f3fb34dd3f76cd36822e7e1ca Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 21 Jul 2015 19:16:53 -0300 Subject: Fixed all the pep8 warnings in the code --- src/leap/mail/imap/tests/__init__.py | 6 +++--- src/leap/mail/imap/tests/test_imap.py | 2 +- src/leap/mail/imap/tests/test_imap_store_fetch.py | 12 ++++++++---- src/leap/mail/imap/tests/walktree.py | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src/leap/mail/imap/tests') diff --git a/src/leap/mail/imap/tests/__init__.py b/src/leap/mail/imap/tests/__init__.py index f3d5ca6..32dacee 100644 --- a/src/leap/mail/imap/tests/__init__.py +++ b/src/leap/mail/imap/tests/__init__.py @@ -1,4 +1,4 @@ -#-*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- """ leap/email/imap/tests/__init__.py ---------------------------------- @@ -26,10 +26,10 @@ from leap.soledad.client import Soledad from leap.soledad.common.document import SoledadDocument -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Some tests inherit from BaseSoledadTest in order to have a working Soledad # instance in each test. -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- class BaseSoledadIMAPTest(BaseLeapTest): """ diff --git a/src/leap/mail/imap/tests/test_imap.py b/src/leap/mail/imap/tests/test_imap.py index af1bd69..ffe59c3 100644 --- a/src/leap/mail/imap/tests/test_imap.py +++ b/src/leap/mail/imap/tests/test_imap.py @@ -439,7 +439,7 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin): d1 = self.connected.addCallback(strip(add_mailbox)) d1.addCallback(strip(login)) d1.addCallback(strip(select)) - #d1.addErrback(self._ebGeneral) + # d1.addErrback(self._ebGeneral) d2 = self.loopback() diff --git a/src/leap/mail/imap/tests/test_imap_store_fetch.py b/src/leap/mail/imap/tests/test_imap_store_fetch.py index 6da8581..81f88fe 100644 --- a/src/leap/mail/imap/tests/test_imap_store_fetch.py +++ b/src/leap/mail/imap/tests/test_imap_store_fetch.py @@ -43,10 +43,14 @@ class StoreAndFetchTestCase(IMAP4HelperMixin): self.connected.addCallback( self._addSignedMessage).addCallback( - lambda uid: self.function( - uids, uid=uid) # do NOT use seq numbers! - ).addCallback(result).addCallback( - self._cbStopClient).addErrback(self._ebGeneral) + lambda uid: self.function( + uids, uid=uid + ) # do NOT use seq numbers! + ).addCallback( + result + ).addCallback( + self._cbStopClient + ).addErrback(self._ebGeneral) d = loopback.loopbackTCP(self.server, self.client, noisy=False) d.addCallback(lambda x: self.assertEqual(self.result, self.expected)) diff --git a/src/leap/mail/imap/tests/walktree.py b/src/leap/mail/imap/tests/walktree.py index 695f487..4544856 100644 --- a/src/leap/mail/imap/tests/walktree.py +++ b/src/leap/mail/imap/tests/walktree.py @@ -1,4 +1,4 @@ -#t -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # walktree.py # Copyright (C) 2013 LEAP # -- cgit v1.2.3 From bb132dcc1b558cfdfd0bf438779fe2ed07827fd5 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 21 Jul 2015 19:30:33 -0300 Subject: Updated pep8 and fixed import and line break warnings --- src/leap/mail/imap/tests/__init__.py | 14 +++++++------- src/leap/mail/imap/tests/walktree.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/leap/mail/imap/tests') diff --git a/src/leap/mail/imap/tests/__init__.py b/src/leap/mail/imap/tests/__init__.py index 32dacee..5cf60ed 100644 --- a/src/leap/mail/imap/tests/__init__.py +++ b/src/leap/mail/imap/tests/__init__.py @@ -10,13 +10,6 @@ code, using twisted.trial, for testing leap_mx. @copyright: © 2013 Kali Kaneko, see COPYLEFT file """ -__all__ = ['test_imap'] - - -def run(): - """xxx fill me in""" - pass - import os import u1db @@ -25,12 +18,19 @@ from leap.common.testing.basetest import BaseLeapTest from leap.soledad.client import Soledad from leap.soledad.common.document import SoledadDocument +__all__ = ['test_imap'] + + +def run(): + """xxx fill me in""" + pass # ----------------------------------------------------------------------------- # Some tests inherit from BaseSoledadTest in order to have a working Soledad # instance in each test. # ----------------------------------------------------------------------------- + class BaseSoledadIMAPTest(BaseLeapTest): """ Instantiates GPG and Soledad for usage in LeapIMAPServer tests. diff --git a/src/leap/mail/imap/tests/walktree.py b/src/leap/mail/imap/tests/walktree.py index 4544856..f259a55 100644 --- a/src/leap/mail/imap/tests/walktree.py +++ b/src/leap/mail/imap/tests/walktree.py @@ -19,6 +19,7 @@ Tests for the walktree module. """ import os import sys +import pprint from email import parser from leap.mail import walk as W @@ -118,7 +119,6 @@ if DEBUG and DO_CHECK: print "Structure: OK" -import pprint print print "RAW DOCS" pprint.pprint(raw_docs) -- cgit v1.2.3 From 3f171207e73790b512cbfa187f8c01e0b5f076a9 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 21 Jul 2015 20:11:29 -0300 Subject: Changed imap tests and messages assigned lambdas to functions because of pep8 --- src/leap/mail/imap/tests/test_imap.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/leap/mail/imap/tests') diff --git a/src/leap/mail/imap/tests/test_imap.py b/src/leap/mail/imap/tests/test_imap.py index ffe59c3..62c3c41 100644 --- a/src/leap/mail/imap/tests/test_imap.py +++ b/src/leap/mail/imap/tests/test_imap.py @@ -387,8 +387,11 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin): acc.addMailbox('this/mbox'), acc.addMailbox('that/mbox')]) - dc1 = lambda: acc.subscribe('this/mbox') - dc2 = lambda: acc.subscribe('that/mbox') + def dc1(): + return acc.subscribe('this/mbox') + + def dc2(): + return acc.subscribe('that/mbox') def login(): return self.client.login(TEST_USER, TEST_PASSWD) @@ -668,9 +671,14 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin): acc = self.server.theAccount - dc1 = lambda: acc.addMailbox('root_subthing', creation_ts=42) - dc2 = lambda: acc.addMailbox('root_another_thing', creation_ts=42) - dc3 = lambda: acc.addMailbox('non_root_subthing', creation_ts=42) + def dc1(): + return acc.addMailbox('root_subthing', creation_ts=42) + + def dc2(): + return acc.addMailbox('root_another_thing', creation_ts=42) + + def dc3(): + return acc.addMailbox('non_root_subthing', creation_ts=42) def login(): return self.client.login(TEST_USER, TEST_PASSWD) -- cgit v1.2.3