From cb342182ee47c3e2c743de50d81aad60f4eebefd Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Mon, 21 Mar 2011 00:26:51 +0100 Subject: [PATCH] Try to strengthen test_httpservers (issue #11617) --- Lib/test/test_httpservers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index a16e0e32b88..39ebc263381 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -38,8 +38,8 @@ class TestServerThread(threading.Thread): self.test_object = test_object def run(self): - self.server = HTTPServer(('', 0), self.request_handler) - self.test_object.PORT = self.server.socket.getsockname()[1] + self.server = HTTPServer(('localhost', 0), self.request_handler) + self.test_object.HOST, self.test_object.PORT = self.server.socket.getsockname() self.test_object.server_started.set() self.test_object = None try: @@ -66,7 +66,7 @@ class BaseTestCase(unittest.TestCase): support.threading_cleanup(*self._threads) def request(self, uri, method='GET', body=None, headers={}): - self.connection = http.client.HTTPConnection('localhost', self.PORT) + self.connection = http.client.HTTPConnection(self.HOST, self.PORT) self.connection.request(method, uri, body, headers) return self.connection.getresponse() @@ -107,7 +107,7 @@ class BaseHTTPServerTestCase(BaseTestCase): def setUp(self): BaseTestCase.setUp(self) - self.con = http.client.HTTPConnection('localhost', self.PORT) + self.con = http.client.HTTPConnection(self.HOST, self.PORT) self.con.connect() def test_command(self):