summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2016-08-25 11:09:47 -0400
committerKali Kaneko <kali@leap.se>2016-08-25 11:13:23 -0400
commit8e4746835a1a053558ff06d4fd12b31167a80296 (patch)
tree56421a7b58ef5c050dbe0706e31e9496075ee055
parent8c49f1e16e8743acf994ec96aaf005275e8f54d5 (diff)
[tests] pep8 fixes + add pep8 step to tox run
-rw-r--r--mail/setup.cfg7
-rw-r--r--mail/src/leap/mail/incoming/tests/test_incoming_mail.py11
-rw-r--r--mail/src/leap/mail/outgoing/service.py2
-rw-r--r--mail/src/leap/mail/testing/__init__.py11
-rw-r--r--mail/tox.ini5
5 files changed, 18 insertions, 18 deletions
diff --git a/mail/setup.cfg b/mail/setup.cfg
index 501ecf1b..a49fd352 100644
--- a/mail/setup.cfg
+++ b/mail/setup.cfg
@@ -9,6 +9,13 @@ ignore = E731
exclude = versioneer.py,_version.py,*.egg,build,docs
ignore = E731
+[tool:pytest]
+pep8ignore =
+ docs/conf.py ALL
+ versioneer.py ALL
+ _version.py ALL
+ *.egg ALL
+
[versioneer]
VCS = git
style = pep440
diff --git a/mail/src/leap/mail/incoming/tests/test_incoming_mail.py b/mail/src/leap/mail/incoming/tests/test_incoming_mail.py
index 09a7e1e1..29422ecc 100644
--- a/mail/src/leap/mail/incoming/tests/test_incoming_mail.py
+++ b/mail/src/leap/mail/incoming/tests/test_incoming_mail.py
@@ -94,11 +94,6 @@ subject: independence of cyberspace
self.tempdir = tempfile.mkdtemp()
def getCollection(_):
- #d = defer.Deferred()
- #acct = IMAPAccount(self._soledad, ADDRESS, d=d)
- #d.addCallback(
- #lambda _: acct.getMailbox(INBOX_NAME))
- #return d
adaptor = SoledadMailAdaptor()
store = self._soledad
adaptor.store = store
@@ -114,7 +109,8 @@ subject: independence of cyberspace
d = adaptor.initialize_store(store)
d.addCallback(lambda _: mbox_indexer.create_table(mbox_uuid))
- d.addCallback(lambda _: adaptor.get_or_create_mbox(store, mbox_name))
+ d.addCallback(
+ lambda _: adaptor.get_or_create_mbox(store, mbox_name))
d.addCallback(get_collection_from_mbox_wrapper)
return d
@@ -277,6 +273,7 @@ subject: independence of cyberspace
def testAddDecryptedHeader(self):
class DummyMsg():
+
def __init__(self):
self.headers = {}
@@ -313,7 +310,7 @@ subject: independence of cyberspace
def decryption_error_not_called(_):
self.assertFalse(self.fetcher._decryption_error.called,
- "There was some errors with decryption")
+ "There was some errors with decryption")
def add_decrypted_header_called(_):
self.assertTrue(self.fetcher._add_decrypted_header.called,
diff --git a/mail/src/leap/mail/outgoing/service.py b/mail/src/leap/mail/outgoing/service.py
index 7699ce79..8b02f2e4 100644
--- a/mail/src/leap/mail/outgoing/service.py
+++ b/mail/src/leap/mail/outgoing/service.py
@@ -354,7 +354,7 @@ class OutgoingMail(object):
return d
def _encrypt_and_sign(self, origmsg, encrypt_address, sign_address,
- fetch_remote=True):
+ fetch_remote=True):
"""
Create an RFC 3156 compliang PGP encrypted and signed message using
C{encrypt_address} to encrypt and C{sign_address} to sign.
diff --git a/mail/src/leap/mail/testing/__init__.py b/mail/src/leap/mail/testing/__init__.py
index 982be557..8822a5c7 100644
--- a/mail/src/leap/mail/testing/__init__.py
+++ b/mail/src/leap/mail/testing/__init__.py
@@ -20,11 +20,9 @@ Base classes and keys for leap.mail tests.
import os
import distutils.spawn
from mock import Mock
-from twisted.internet.defer import gatherResults, succeed
+from twisted.internet.defer import gatherResults
from twisted.trial import unittest
-from twisted.web.client import Response
from twisted.internet import defer
-from twisted.python import log
from leap.soledad.client import Soledad
@@ -36,6 +34,7 @@ from leap.common.testing.basetest import BaseLeapTest
ADDRESS = 'leap@leap.se'
ADDRESS_2 = 'anotheruser@leap.se'
+
class defaultMockSharedDB(object):
get_doc = Mock(return_value=None)
put_doc = Mock(side_effect=None)
@@ -68,16 +67,12 @@ class KeyManagerWithSoledadTestCase(unittest.TestCase, BaseLeapTest):
class Response(object):
code = 200
phrase = ''
+
def deliverBody(self, x):
return ''
- # XXX why the fuck is this needed? ------------------------
self.km._async_client_pinned.request = Mock(
return_value=defer.succeed(Response()))
- #self.km._async_client.request = Mock(return_value='')
- #self.km._async_client_pinned.request = Mock(
- #return_value='')
- # -------------------------------------------------------
d1 = self.km.put_raw_key(PRIVATE_KEY, ADDRESS)
d2 = self.km.put_raw_key(PRIVATE_KEY_2, ADDRESS_2)
diff --git a/mail/tox.ini b/mail/tox.ini
index ff4299d4..e2393f74 100644
--- a/mail/tox.ini
+++ b/mail/tox.ini
@@ -2,13 +2,14 @@
envlist = py27
[testenv]
-commands = py.test {posargs}
+commands = py.test --pep8 {posargs}
deps =
mock
+ pep8
pytest
+ pytest-pep8
pdbpp
setuptools-trial
- pep8
-e../soledad/common
-e../soledad/client
-e../keymanager