diff options
author | Victor Stinner <vstinner@python.org> | 2019-12-11 21:17:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-11 21:17:04 (GMT) |
commit | 7772b1af5ebc9d72d0cfc8332aea6b2143eafa27 (patch) | |
tree | ab891c2456b721210dca1d5462f18b0e4d46dabf /Lib/test/test_socket.py | |
parent | 0d63bacefd2e5b937ec6b0ec3053777c09941b4a (diff) | |
download | cpython-7772b1af5ebc9d72d0cfc8332aea6b2143eafa27.zip cpython-7772b1af5ebc9d72d0cfc8332aea6b2143eafa27.tar.gz cpython-7772b1af5ebc9d72d0cfc8332aea6b2143eafa27.tar.bz2 |
Diffstat (limited to 'Lib/test/test_socket.py')
-rwxr-xr-x | Lib/test/test_socket.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 184c67c..64e95ea 100755 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -5063,14 +5063,16 @@ class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest): testFamily = _justAccept def _testFamily(self): - self.cli = socket.create_connection((HOST, self.port), timeout=30) + self.cli = socket.create_connection((HOST, self.port), + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(self.cli.close) self.assertEqual(self.cli.family, 2) testSourceAddress = _justAccept def _testSourceAddress(self): - self.cli = socket.create_connection((HOST, self.port), timeout=30, - source_address=('', self.source_port)) + self.cli = socket.create_connection((HOST, self.port), + timeout=support.LOOPBACK_TIMEOUT, + source_address=('', self.source_port)) self.addCleanup(self.cli.close) self.assertEqual(self.cli.getsockname()[1], self.source_port) # The port number being used is sufficient to show that the bind() @@ -5959,7 +5961,9 @@ class SendfileUsingSendTest(ThreadedTCPSocketTest): def _testCount(self): address = self.serv.getsockname() file = open(support.TESTFN, 'rb') - with socket.create_connection(address, timeout=2) as sock, file as file: + sock = socket.create_connection(address, + timeout=support.LOOPBACK_TIMEOUT) + with sock, file: count = 5000007 meth = self.meth_from_sock(sock) sent = meth(file, count=count) @@ -5978,7 +5982,9 @@ class SendfileUsingSendTest(ThreadedTCPSocketTest): def _testCountSmall(self): address = self.serv.getsockname() file = open(support.TESTFN, 'rb') - with socket.create_connection(address, timeout=2) as sock, file as file: + sock = socket.create_connection(address, + timeout=support.LOOPBACK_TIMEOUT) + with sock, file: count = 1 meth = self.meth_from_sock(sock) sent = meth(file, count=count) @@ -6032,7 +6038,9 @@ class SendfileUsingSendTest(ThreadedTCPSocketTest): def _testWithTimeout(self): address = self.serv.getsockname() file = open(support.TESTFN, 'rb') - with socket.create_connection(address, timeout=2) as sock, file as file: + sock = socket.create_connection(address, + timeout=support.LOOPBACK_TIMEOUT) + with sock, file: meth = self.meth_from_sock(sock) sent = meth(file) self.assertEqual(sent, self.FILESIZE) |