Flake8 cubicweb/devtools/httptest.py
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 21 Mar 2019 14:36:25 +0100
changeset 12531 2b9e815d20dc
parent 12530 9d88e1177c35
child 12532 38004d09d178
Flake8 cubicweb/devtools/httptest.py
cubicweb/devtools/httptest.py
flake8-ok-files.txt
--- a/cubicweb/devtools/httptest.py	Thu Mar 21 14:33:54 2019 +0100
+++ b/cubicweb/devtools/httptest.py	Thu Mar 21 14:36:25 2019 +0100
@@ -20,8 +20,6 @@
 """
 from __future__ import print_function
 
-
-
 import random
 import threading
 import socket
@@ -31,7 +29,6 @@
 
 
 from cubicweb.devtools.testlib import CubicWebTC
-from cubicweb.devtools import ApptestConfiguration
 
 
 def get_available_port(ports_scan):
@@ -53,7 +50,7 @@
     for port in ports_scan:
         try:
             s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-            sock = s.connect(("localhost", port))
+            s.connect(("localhost", port))
         except socket.error as err:
             if err.args[0] in (111, 106):
                 return port
@@ -80,7 +77,7 @@
         If no user is provided, admin connection are used.
         """
         if user is None:
-            user  = self.admlogin
+            user = self.admlogin
             passwd = self.admpassword
         if passwd is None:
             passwd = user
@@ -94,7 +91,7 @@
     def web_logout(self, user='admin', pwd=None):
         """Log out current http user"""
         if self._ident_cookie is not None:
-            response = self.web_get('logout')
+            self.web_get('logout')
         self._ident_cookie = None
 
     def web_request(self, path='', method='GET', body=None, headers=None):
@@ -109,8 +106,8 @@
             headers['Cookie'] = self._ident_cookie
         self._web_test_cnx.request(method, '/' + path, headers=headers, body=body)
         response = self._web_test_cnx.getresponse()
-        response.body = response.read() # to chain request
-        response.read = lambda : response.body
+        response.body = response.read()  # to chain request
+        response.read = lambda: response.body
         return response
 
     def web_get(self, path='', body=None, headers=None):
@@ -119,7 +116,7 @@
     def setUp(self):
         super(_CubicWebServerTC, self).setUp()
         port = self.config['port'] or get_available_port(self.ports_range)
-        self.config.global_set_option('port', port) # force rewrite here
+        self.config.global_set_option('port', port)  # force rewrite here
         self.config.global_set_option('base-url', 'http://127.0.0.1:%d/' % port)
         # call load_configuration again to let the config reset its datadir_url
         self.config.load_configuration()
--- a/flake8-ok-files.txt	Thu Mar 21 14:33:54 2019 +0100
+++ b/flake8-ok-files.txt	Thu Mar 21 14:36:25 2019 +0100
@@ -12,6 +12,7 @@
 cubicweb/dataimport/test/test_massive_store.py
 cubicweb/dataimport/test/test_stores.py
 cubicweb/dataimport/test/unittest_importer.py
+cubicweb/devtools/httptest.py
 cubicweb/devtools/test/data/cubes/i18ntestcube/__init__.py
 cubicweb/devtools/test/data/cubes/i18ntestcube/views.py
 cubicweb/devtools/test/data/cubes/__init__.py