Back to index

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

List of all members.

Public Member Functions

def __init__
def setUp
def clientSetUp
def testStream
def serverExplicitReady
def clientRun
def clientTearDown

Public Attributes

 srv
 connaddr
 cli
 cliaddr
 setUp
 tearDown
 server_ready
 client_ready
 done
 queue
 client_thread

Private Member Functions

def _testStream

Detailed Description

Definition at line 1892 of file test_socket.py.


Constructor & Destructor Documentation

def test.test_socket.TIPCThreadableTest.__init__ (   self,
  methodName = 'runTest' 
)

Definition at line 1893 of file test_socket.py.

01893 
01894     def __init__(self, methodName = 'runTest'):
01895         unittest.TestCase.__init__(self, methodName = methodName)
01896         ThreadableTest.__init__(self)

Here is the caller graph for this function:


Member Function Documentation

Definition at line 1923 of file test_socket.py.

01923 
01924     def _testStream(self):
01925         self.cli.send(MSG)
01926         self.cli.close()
01927 
01928 
@unittest.skipUnless(thread, 'Threading required for this test.')
def test.test_socket.ThreadableTest.clientRun (   self,
  test_func 
) [inherited]

Definition at line 157 of file test_socket.py.

00157 
00158     def clientRun(self, test_func):
00159         self.server_ready.wait()
00160         self.client_ready.set()
00161         self.clientSetUp()
00162         if not hasattr(test_func, '__call__'):
00163             raise TypeError("test_func must be a callable function")
00164         try:
00165             test_func()
00166         except BaseException as e:
00167             self.queue.put(e)
00168         finally:
00169             self.clientTearDown()

Here is the call graph for this function:

Reimplemented from test.test_socket.ThreadableTest.

Definition at line 1907 of file test_socket.py.

01907 
01908     def clientSetUp(self):
01909         # The is a hittable race between serverExplicitReady() and the
01910         # accept() call; sleep a little while to avoid it, otherwise
01911         # we could get an exception
01912         time.sleep(0.1)
01913         self.cli = socket.socket(socket.AF_TIPC, socket.SOCK_STREAM)
01914         addr = (socket.TIPC_ADDR_NAME, TIPC_STYPE,
01915                 TIPC_LOWER + int((TIPC_UPPER - TIPC_LOWER) / 2), 0)
01916         self.cli.connect(addr)
01917         self.cliaddr = self.cli.getsockname()

This method allows the server to explicitly indicate that
it wants the client thread to proceed. This is useful if the
server is about to execute a blocking routine that is
dependent upon the client thread during its setup routine.

Definition at line 123 of file test_socket.py.

00123 
00124     def serverExplicitReady(self):
00125         """This method allows the server to explicitly indicate that
00126         it wants the client thread to proceed. This is useful if the
00127         server is about to execute a blocking routine that is
00128         dependent upon the client thread during its setup routine."""
00129         self.server_ready.set()

Here is the caller graph for this function:

Definition at line 1897 of file test_socket.py.

01897 
01898     def setUp(self):
01899         self.srv = socket.socket(socket.AF_TIPC, socket.SOCK_STREAM)
01900         self.srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
01901         srvaddr = (socket.TIPC_ADDR_NAMESEQ, TIPC_STYPE,
01902                 TIPC_LOWER, TIPC_UPPER)
01903         self.srv.bind(srvaddr)
01904         self.srv.listen(5)
01905         self.serverExplicitReady()
01906         self.conn, self.connaddr = self.srv.accept()

Here is the caller graph for this function:

Definition at line 1918 of file test_socket.py.

01918 
01919     def testStream(self):
01920         msg = self.conn.recv(1024)
01921         self.assertEqual(msg, MSG)
01922         self.assertEqual(self.cliaddr, self.connaddr)

Here is the call graph for this function:


Member Data Documentation

Definition at line 1912 of file test_socket.py.

Definition at line 1916 of file test_socket.py.

Definition at line 132 of file test_socket.py.

Definition at line 141 of file test_socket.py.

Definition at line 1905 of file test_socket.py.

Definition at line 133 of file test_socket.py.

Definition at line 134 of file test_socket.py.

Definition at line 131 of file test_socket.py.

Definition at line 120 of file test_socket.py.

Definition at line 1898 of file test_socket.py.

Definition at line 121 of file test_socket.py.


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