Back to index

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

List of all members.

Public Member Functions

def setUp

Static Public Attributes

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

Private Member Functions

def _sock_operation

Detailed Description

Definition at line 91 of file test_timeout.py.


Member Function Documentation

def test.test_timeout.TimeoutTestCase._sock_operation (   self,
  count,
  timeout,
  method,
  args 
) [private]
Test the specified socket method.

The method is run at most `count` times and must raise a socket.timeout
within `timeout` + self.fuzz seconds.

Definition at line 107 of file test_timeout.py.

00107 
00108     def _sock_operation(self, count, timeout, method, *args):
00109         """
00110         Test the specified socket method.
00111 
00112         The method is run at most `count` times and must raise a socket.timeout
00113         within `timeout` + self.fuzz seconds.
00114         """
00115         self.sock.settimeout(timeout)
00116         method = getattr(self.sock, method)
00117         for i in range(count):
00118             t1 = time.time()
00119             try:
00120                 method(*args)
00121             except socket.timeout as e:
00122                 delta = time.time() - t1
00123                 break
00124         else:
00125             self.fail('socket.timeout was not raised')
00126         # These checks should account for timing unprecision
00127         self.assertLess(delta, timeout + self.fuzz)
00128         self.assertGreater(delta, timeout - 1.0)
00129 

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in test.test_timeout.UDPTimeoutTestCase, and test.test_timeout.TCPTimeoutTestCase.

Definition at line 102 of file test_timeout.py.

00102 
00103     def setUp(self):
00104         raise NotImplementedError()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 98 of file test_timeout.py.

Definition at line 100 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: