Back to index

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

List of all members.

Public Member Functions

def __init__
def testSendtoAndRecv
def testRecvFrom
def testRecvFromNegative
def clientSetUp
def clientTearDown
def setUp
def tearDown
def serverExplicitReady
def clientRun

Public Attributes

 cli
 serv
 port
 setUp
 tearDown
 server_ready
 client_ready
 done
 queue
 client_thread

Private Member Functions

def _testSendtoAndRecv
def _testRecvFrom
def _testRecvFromNegative

Detailed Description

Definition at line 895 of file test_socket.py.


Constructor & Destructor Documentation

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

Reimplemented from test.test_socket.ThreadedUDPSocketTest.

Definition at line 897 of file test_socket.py.

00897 
00898     def __init__(self, methodName='runTest'):
00899         ThreadedUDPSocketTest.__init__(self, methodName=methodName)

Here is the caller graph for this function:


Member Function Documentation

Definition at line 913 of file test_socket.py.

00913 
00914     def _testRecvFrom(self):
00915         self.cli.sendto(MSG, 0, (HOST, self.port))

Definition at line 920 of file test_socket.py.

00920 
00921     def _testRecvFromNegative(self):
00922         self.cli.sendto(MSG, 0, (HOST, self.port))
00923 
@unittest.skipUnless(thread, 'Threading required for this test.')

Definition at line 905 of file test_socket.py.

00905 
00906     def _testSendtoAndRecv(self):
00907         self.cli.sendto(MSG, 0, (HOST, self.port))

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 197 of file test_socket.py.

00197 
00198     def clientSetUp(self):
00199         self.cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

Reimplemented from test.test_socket.ThreadableTest.

Definition at line 200 of file test_socket.py.

00200 
00201     def clientTearDown(self):
00202         self.cli.close()
00203         self.cli = None
00204         ThreadableTest.clientTearDown(self)

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:

def test.test_socket.SocketUDPTest.setUp (   self) [inherited]

Definition at line 70 of file test_socket.py.

00070 
00071     def setUp(self):
00072         self.serv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
00073         self.port = support.bind_port(self.serv)

Here is the caller graph for this function:

def test.test_socket.SocketUDPTest.tearDown (   self) [inherited]

Definition at line 74 of file test_socket.py.

00074 
00075     def tearDown(self):
00076         self.serv.close()
00077         self.serv = None

Here is the caller graph for this function:

Definition at line 908 of file test_socket.py.

00908 
00909     def testRecvFrom(self):
00910         # Testing recvfrom() over UDP
00911         msg, addr = self.serv.recvfrom(len(MSG))
00912         self.assertEqual(msg, MSG)

Here is the call graph for this function:

Definition at line 916 of file test_socket.py.

00916 
00917     def testRecvFromNegative(self):
00918         # Negative lengths passed to recvfrom should give ValueError.
00919         self.assertRaises(ValueError, self.serv.recvfrom, -1)

Here is the call graph for this function:

Definition at line 900 of file test_socket.py.

00900 
00901     def testSendtoAndRecv(self):
00902         # Testing sendto() and Recv() over UDP
00903         msg = self.serv.recv(len(MSG))
00904         self.assertEqual(msg, MSG)

Here is the call graph for this function:


Member Data Documentation

Definition at line 198 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 133 of file test_socket.py.

Definition at line 72 of file test_socket.py.

Definition at line 134 of file test_socket.py.

Definition at line 71 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 121 of file test_socket.py.


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