summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.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_socket.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_socket.py')
-rw-r--r--Lib/test/test_socket.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index a7ebe04..ade524f 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -844,22 +844,24 @@ class NetworkConnectionAttributesTest(unittest.TestCase):
self.assertTrue(sock.gettimeout() is None)
# a value, named
- sock = socket.create_connection((HOST, PORT), timeout=10)
- self.assertEqual(sock.gettimeout(), 10)
+ sock = socket.create_connection((HOST, PORT), timeout=30)
+ self.assertEqual(sock.gettimeout(), 30)
# a value, just the value
- sock = socket.create_connection((HOST, PORT), 10)
- self.assertEqual(sock.gettimeout(), 10)
+ sock = socket.create_connection((HOST, PORT), 30)
+ self.assertEqual(sock.gettimeout(), 30)
# None, having other default
previous = socket.getdefaulttimeout()
- socket.setdefaulttimeout(10)
- sock = socket.create_connection((HOST, PORT), timeout=None)
- socket.setdefaulttimeout(previous)
- self.assertEqual(sock.gettimeout(), 10)
+ socket.setdefaulttimeout(30)
+ try:
+ sock = socket.create_connection((HOST, PORT), timeout=None)
+ finally:
+ socket.setdefaulttimeout(previous)
+ self.assertEqual(sock.gettimeout(), 30)
def testFamily(self):
- sock = socket.create_connection((HOST, PORT), timeout=10)
+ sock = socket.create_connection((HOST, PORT), timeout=30)
self.assertEqual(sock.family, 2)