[style] fix pep8 warnings
authorFolker Bernitt <fbernitt@thoughtworks.com>
Thu, 24 Sep 2015 12:04:43 +0000 (14:04 +0200)
committerKali Kaneko <kali@leap.se>
Thu, 24 Sep 2015 16:09:49 +0000 (12:09 -0400)
src/leap/keymanager/__init__.py
src/leap/keymanager/tests/test_keymanager.py

index f00e049..01f3b6e 100644 (file)
@@ -22,7 +22,9 @@ import fileinput
 import os
 import sys
 import tempfile
+
 from leap.common import ca_bundle
+
 from ._version import get_versions
 
 try:
@@ -146,7 +148,8 @@ class KeyManager(object):
 
     def __del__(self):
         try:
-            created_tmp_combined_ca_bundle = self._combined_ca_bundle not in [ca_bundle.where(), self._ca_cert_path]
+            created_tmp_combined_ca_bundle = self._combined_ca_bundle not in \
+                [ca_bundle.where(), self._ca_cert_path]
             if created_tmp_combined_ca_bundle:
                 os.remove(self._combined_ca_bundle)
         except OSError:
@@ -164,7 +167,7 @@ class KeyManager(object):
         elif not self._ca_cert_path:
             return leap_ca_bundle
 
-        tmp_file = tempfile.NamedTemporaryFile(delete=False)  # delete when keymanager expires
+        tmp_file = tempfile.NamedTemporaryFile(delete=False)
 
         with open(tmp_file.name, 'w') as fout:
             fin = fileinput.input(files=(leap_ca_bundle, self._ca_cert_path))
index b2722b2..8d4c5da 100644 (file)
@@ -357,7 +357,7 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase):
                                          verify=ca_bundle.where())
 
     @inlineCallbacks
-    def test_fetch_key_uses_default_ca_bundle_if_also_set_as_ca_cert_path(self):
+    def test_fetch_key_use_default_ca_bundle_if_set_as_ca_cert_path(self):
         ca_cert_path = ca_bundle.where()
         km = self._key_manager(ca_cert_path=ca_cert_path)
         get_mock = self._mock_get_response(km, PUBLIC_KEY_OTHER)
@@ -369,7 +369,8 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase):
 
     @inlineCallbacks
     def test_fetch_uses_combined_ca_bundle_otherwise(self):
-        with tempfile.NamedTemporaryFile() as tmp_input, tempfile.NamedTemporaryFile(delete=False) as tmp_output:
+        with tempfile.NamedTemporaryFile() as tmp_input, \
+                tempfile.NamedTemporaryFile(delete=False) as tmp_output:
             ca_content = 'some\ncontent\n'
             ca_cert_path = tmp_input.name
             self._dump_to_file(ca_cert_path, ca_content)