From c7f878b2dcaa38a556ea0e25253db45ecc89c8cc Mon Sep 17 00:00:00 2001 From: Martin Vrachev Date: Thu, 7 May 2020 17:58:37 +0300 Subject: [PATCH] Remove six.PY2 and platform checks and add warning After a discussion with Joshua Lock, we agreed that for Windows users it would be good to provide the option to use SimpleHTTPRequestHandler, but still leave a warning about it, knowing that this caused an error before. See: https://github.com/theupdateframework/tuf/commit/7dbb30ae1006d0b5f506bba19d4b53398c44f139 Signed-off-by: Martin Vrachev --- tests/simple_server.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/simple_server.py b/tests/simple_server.py index 4f7b96da..cc8e3db3 100755 --- a/tests/simple_server.py +++ b/tests/simple_server.py @@ -66,20 +66,19 @@ def log_request(self, code='-', size='-'): # NOTE: On Windows/Python2 tests that use this simple_server.py in a # subprocesses hang after a certain amount of requests (~68), if a PIPE is -# passed as Popen's stderr argument. As a simple workaround we silence the -# server on those Windows/Py2 to not fill the buffer. -if six.PY2 and platform.system() == 'Windows': +# passed as Popen's stderr argument. This problem doesn't emerge if +# we silence the HTTP messages. +# If you decide to receive the HTTP messages, then this bug +# could reappear. +use_quiet_http_request_handler = True + +if len(sys.argv) > 2: + use_quiet_http_request_handler = sys.argv[2] + +if use_quiet_http_request_handler: handler = QuietHTTPRequestHandler else: - use_quiet_http_request_handler = True - - if len(sys.argv) > 2: - use_quiet_http_request_handler = sys.argv[2] - - if use_quiet_http_request_handler: - handler = QuietHTTPRequestHandler - else: - handler = SimpleHTTPRequestHandler + handler = SimpleHTTPRequestHandler httpd = six.moves.socketserver.TCPServer(('', PORT), handler)