summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_httplib.py
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2007-03-23 20:23:08 (GMT)
committerFacundo Batista <facundobatista@gmail.com>2007-03-23 20:23:08 (GMT)
commit14553b08a1f93bb4ec8f8c2239ef240f634cc2da (patch)
tree6f3bb122e49d4b9051ebb4a525abbf8dd3f12e52 /Lib/test/test_httplib.py
parente6a70394518340fc595ff67fcfbf8e4c3ffbfd48 (diff)
downloadcpython-14553b08a1f93bb4ec8f8c2239ef240f634cc2da.zip
cpython-14553b08a1f93bb4ec8f8c2239ef240f634cc2da.tar.gz
cpython-14553b08a1f93bb4ec8f8c2239ef240f634cc2da.tar.bz2
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange results in others. Also relaxed the timeout settings in the test (where actually the value didn't mean anything).
Diffstat (limited to 'Lib/test/test_httplib.py')
-rw-r--r--Lib/test/test_httplib.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index a39a3eb..78aa651 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -176,17 +176,19 @@ class TimeoutTest(TestCase):
self.assertTrue(httpConn.sock.gettimeout() is None)
# a value
- httpConn = httplib.HTTPConnection(HOST, PORT, timeout=10)
+ httpConn = httplib.HTTPConnection(HOST, PORT, timeout=30)
httpConn.connect()
- self.assertEqual(httpConn.sock.gettimeout(), 10)
+ self.assertEqual(httpConn.sock.gettimeout(), 30)
# None, having other default
previous = socket.getdefaulttimeout()
- socket.setdefaulttimeout(10)
- httpConn = httplib.HTTPConnection(HOST, PORT, timeout=None)
- httpConn.connect()
- socket.setdefaulttimeout(previous)
- self.assertEqual(httpConn.sock.gettimeout(), 10)
+ socket.setdefaulttimeout(30)
+ try:
+ httpConn = httplib.HTTPConnection(HOST, PORT, timeout=None)
+ httpConn.connect()
+ finally:
+ socket.setdefaulttimeout(previous)
+ self.assertEqual(httpConn.sock.gettimeout(), 30)
def test_main(verbose=None):