From f196629eba4c663827bf259dae95929aaaf7455b Mon Sep 17 00:00:00 2001 From: Facundo Batista Date: Sun, 25 Mar 2007 03:20:05 +0000 Subject: [PATCH] Closing the HTTP connection after each test, and listening more. --- Lib/test/test_httplib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 78aa6519b8a..c1ec4a0f44b 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -160,7 +160,7 @@ class TimeoutTest(TestCase): self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) global PORT PORT = test_support.bind_port(self.serv, HOST, PORT) - self.serv.listen(1) + self.serv.listen(5) def tearDown(self): self.serv.close() @@ -174,11 +174,13 @@ class TimeoutTest(TestCase): httpConn = httplib.HTTPConnection(HOST, PORT) httpConn.connect() self.assertTrue(httpConn.sock.gettimeout() is None) + httpConn.close() # a value httpConn = httplib.HTTPConnection(HOST, PORT, timeout=30) httpConn.connect() self.assertEqual(httpConn.sock.gettimeout(), 30) + httpConn.close() # None, having other default previous = socket.getdefaulttimeout() @@ -189,6 +191,7 @@ class TimeoutTest(TestCase): finally: socket.setdefaulttimeout(previous) self.assertEqual(httpConn.sock.gettimeout(), 30) + httpConn.close() def test_main(verbose=None):