Skip to content
Myr

Fixed style issues

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Braulio Valdivielso Martínez · committed by Braulio Valdivielso Martínez · parent bf026e3 · Browse files · 1 file+7 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−13 removed

  • tests:+7 added−13 removed

1 file+7 added−13 removed

modified:tests/testserver/server.py+7 added-13 removed
1#!/usr/bin/python21import threading 2import socket3import select475def consume_socket_content(sock, timeout=0.5):6 chunks = 655367 content = ""8 more_to_read = select.select([sock], [], [], timeout)[0]
4 unmodified lines
13 if not new_content:14 break1516 content += new_content 20 # stop reading if no new data is received for a while 17 # stop reading if no new data is received for a while18 more_to_read = select.select([sock], [], [], timeout)[0] 1920 return content21252622class Server(threading.Thread):28 """ Dummy server using for unit testing """23 """Dummy server using for unit testing"""24 WAIT_EVENT_TIMEOUT = 52526 def __init__(self, handler, host='localhost', port=0, requests_to_handle=1, wait_to_close_event=None):32 threading.Thread.__init__(self)27 super(Server, self).__init__()2829 self.handler = handler30 self.handler_results = []31
13 unmodified lines
4546 return request_content474854 server = Server(text_response_handler, **kwargs)55 return server49 return Server(text_response_handler, **kwargs)5051 @classmethod52 def basic_response_server(cls, **kwargs):59 server = cls.text_response_server(53 return cls.text_response_server(54 "HTTP/1.1 200 OK\r\n" +61 "Content-Length: 0\r\n\r\n", **kwargs55 "Content-Length: 0\r\n\r\n", 56 **kwargs57 )63 return server5859 def run(self):60 try:61 sock = self._create_socket_and_bind()
40 unmodified lines