Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_timeout.TCPTimeoutTestCase Class Reference
Inheritance diagram for test.test_timeout.TCPTimeoutTestCase:
Inheritance graph
[legend]
Collaboration diagram for test.test_timeout.TCPTimeoutTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def testConnectTimeout
def testRecvTimeout
def testAcceptTimeout
def testSend
def testSendto
def testSendall

Public Attributes

 sock
 addr_remote

Static Public Attributes

float fuzz = 2.0
string localhost = '127.0.0.1'
 tearDown = setUp

Detailed Description

TCP test case for socket.socket() timeout functions

Definition at line 130 of file test_timeout.py.


Member Function Documentation

Reimplemented from test.test_timeout.TimeoutTestCase.

Definition at line 133 of file test_timeout.py.

00133 
00134     def setUp(self):
00135         self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
00136         self.addr_remote = ('www.python.org.', 80)

Here is the caller graph for this function:

Definition at line 137 of file test_timeout.py.

00137 
00138     def tearDown(self):
00139         self.sock.close()

Here is the caller graph for this function:

Definition at line 156 of file test_timeout.py.

00156 
00157     def testAcceptTimeout(self):
00158         # Test accept() timeout
00159         support.bind_port(self.sock, self.localhost)
00160         self.sock.listen(5)
00161         self._sock_operation(1, 1.5, 'accept')

Here is the call graph for this function:

Definition at line 140 of file test_timeout.py.

00140 
00141     def testConnectTimeout(self):
00142         # Choose a private address that is unlikely to exist to prevent
00143         # failures due to the connect succeeding before the timeout.
00144         # Use a dotted IP address to avoid including the DNS lookup time
00145         # with the connect time.  This avoids failing the assertion that
00146         # the timeout occurred fast enough.
00147         addr = ('10.0.0.0', 12345)
00148         with support.transient_internet(addr[0]):
00149             self._sock_operation(1, 0.001, 'connect', addr)

Here is the call graph for this function:

Definition at line 150 of file test_timeout.py.

00150 
00151     def testRecvTimeout(self):
00152         # Test recv() timeout
00153         with support.transient_internet(self.addr_remote[0]):
00154             self.sock.connect(self.addr_remote)
00155             self._sock_operation(1, 1.5, 'recv', 1024)

Here is the call graph for this function:

Definition at line 162 of file test_timeout.py.

00162 
00163     def testSend(self):
00164         # Test send() timeout
00165         with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
00166             support.bind_port(serv, self.localhost)
00167             serv.listen(5)
00168             self.sock.connect(serv.getsockname())
00169             # Send a lot of data in order to bypass buffering in the TCP stack.
00170             self._sock_operation(100, 1.5, 'send', b"X" * 200000)

Here is the call graph for this function:

Definition at line 181 of file test_timeout.py.

00181 
00182     def testSendall(self):
00183         # Test sendall() timeout
00184         with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
00185             support.bind_port(serv, self.localhost)
00186             serv.listen(5)
00187             self.sock.connect(serv.getsockname())
00188             # Send a lot of data in order to bypass buffering in the TCP stack.
00189             self._sock_operation(100, 1.5, 'sendall', b"X" * 200000)
00190 

Here is the call graph for this function:

Definition at line 171 of file test_timeout.py.

00171 
00172     def testSendto(self):
00173         # Test sendto() timeout
00174         with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
00175             support.bind_port(serv, self.localhost)
00176             serv.listen(5)
00177             self.sock.connect(serv.getsockname())
00178             # The address argument is ignored since we already connected.
00179             self._sock_operation(100, 1.5, 'sendto', b"X" * 200000,
00180                                  serv.getsockname())

Here is the call graph for this function:


Member Data Documentation

Definition at line 135 of file test_timeout.py.

float test.test_timeout.TimeoutTestCase.fuzz = 2.0 [static, inherited]

Definition at line 98 of file test_timeout.py.

string test.test_timeout.TimeoutTestCase.localhost = '127.0.0.1' [static, inherited]

Definition at line 100 of file test_timeout.py.

Definition at line 134 of file test_timeout.py.

Definition at line 105 of file test_timeout.py.


The documentation for this class was generated from the following file: