Back to index

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

List of all members.

Public Member Functions

def testClose
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 _testClose

Detailed Description

Definition at line 924 of file test_socket.py.


Member Function Documentation

Definition at line 939 of file test_socket.py.

00939 
00940     def _testClose(self):
00941         self.cli.connect((HOST, self.port))
00942         time.sleep(1.0)
00943 
@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.

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

Definition at line 183 of file test_socket.py.

00183 
00184     def clientSetUp(self):
00185         self.cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

Reimplemented from test.test_socket.ThreadableTest.

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

Definition at line 186 of file test_socket.py.

00186 
00187     def clientTearDown(self):
00188         self.cli.close()
00189         self.cli = None
00190         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 926 of file test_socket.py.

00926 
00927     def testClose(self):
00928         conn, addr = self.serv.accept()
00929         conn.close()
00930 
00931         sd = self.cli
00932         read, write, err = select.select([sd], [], [], 1.0)
00933         self.assertEqual(read, [sd])
00934         self.assertEqual(sd.recv(1), b'')
00935 
00936         # Calling close() many times should be safe.
00937         conn.close()
00938         conn.close()

Here is the call graph for this function:


Member Data Documentation

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


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