diff options
author | Facundo Batista <facundobatista@gmail.com> | 2007-03-23 20:23:08 +0000 |
---|---|---|
committer | Facundo Batista <facundobatista@gmail.com> | 2007-03-23 20:23:08 +0000 |
commit | 14553b08a1f93bb4ec8f8c2239ef240f634cc2da (patch) | |
tree | 6f3bb122e49d4b9051ebb4a525abbf8dd3f12e52 /Lib/test/test_httplib.py | |
parent | e6a70394518340fc595ff67fcfbf8e4c3ffbfd48 (diff) | |
download | cpython-git-14553b08a1f93bb4ec8f8c2239ef240f634cc2da.tar.gz |
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.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index a39a3eb501..78aa6519b8 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): |