Back to index

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

List of all members.

Public Member Functions

def __init__
def clientSetUp
def clientTearDown
def testInsideTimeout
def setUp
def tearDown
def serverExplicitReady
def clientRun

Public Attributes

 cli
 serv
 port
 setUp
 tearDown
 server_ready
 client_ready
 done
 queue
 client_thread

Static Public Attributes

 testOutsideTimeout = testInsideTimeout

Private Member Functions

def _testInsideTimeout
def _testOutsideTimeout

Detailed Description

Definition at line 1637 of file test_socket.py.


Constructor & Destructor Documentation

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

Definition at line 1639 of file test_socket.py.

01639 
01640     def __init__(self, methodName='runTest'):
01641         SocketTCPTest.__init__(self, methodName=methodName)
01642         ThreadableTest.__init__(self)

Here is the caller graph for this function:


Member Function Documentation

Definition at line 1658 of file test_socket.py.

01658 
01659     def _testInsideTimeout(self):
01660         self.cli = sock = socket.create_connection((HOST, self.port))
01661         data = sock.recv(5)
01662         self.assertEqual(data, b"done!")

Here is the call graph for this function:

Definition at line 1663 of file test_socket.py.

01663 
01664     def _testOutsideTimeout(self):
01665         self.cli = sock = socket.create_connection((HOST, self.port), timeout=1)
01666         self.assertRaises(socket.timeout, lambda: sock.recv(5))
01667 

Here is the call graph for this function:

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

01643 
01644     def clientSetUp(self):
01645         pass

Reimplemented from test.test_socket.ThreadableTest.

Definition at line 1646 of file test_socket.py.

01646 
01647     def clientTearDown(self):
01648         self.cli.close()
01649         self.cli = None
01650         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.SocketTCPTest.setUp (   self) [inherited]

Reimplemented in test.test_socket.FileObjectClassTestCase, and test.test_socket.SocketConnectedTest.

Definition at line 59 of file test_socket.py.

00059 
00060     def setUp(self):
00061         self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
00062         self.port = support.bind_port(self.serv)
00063         self.serv.listen(1)

Here is the caller graph for this function:

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

Reimplemented in test.test_socket.FileObjectClassTestCase, and test.test_socket.SocketConnectedTest.

Definition at line 64 of file test_socket.py.

00064 
00065     def tearDown(self):
00066         self.serv.close()
00067         self.serv = None

Here is the caller graph for this function:

Definition at line 1651 of file test_socket.py.

01651 
01652     def testInsideTimeout(self):
01653         conn, addr = self.serv.accept()
01654         self.addCleanup(conn.close)
01655         time.sleep(3)
        conn.send(b"done!")

Here is the call graph for this function:


Member Data Documentation

Definition at line 1648 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.

Reimplemented in test.test_socket.NonBlockingTCPTests.

Definition at line 61 of file test_socket.py.

Definition at line 134 of file test_socket.py.

Reimplemented in test.test_socket.NonBlockingTCPTests.

Definition at line 60 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.

Definition at line 1656 of file test_socket.py.


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