Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
test.test_asyncore.DispatcherWithSendTests Class Reference
Inheritance diagram for test.test_asyncore.DispatcherWithSendTests:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def test_send

Static Public Attributes

 usepoll = False

Detailed Description

Definition at line 342 of file test_asyncore.py.


Member Function Documentation

Definition at line 345 of file test_asyncore.py.

00345 
00346     def setUp(self):
00347         pass

Here is the caller graph for this function:

Definition at line 348 of file test_asyncore.py.

00348 
00349     def tearDown(self):
00350         asyncore.close_all()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 353 of file test_asyncore.py.

00353 
00354     def test_send(self):
00355         evt = threading.Event()
00356         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
00357         sock.settimeout(3)
00358         port = support.bind_port(sock)
00359 
00360         cap = BytesIO()
00361         args = (evt, cap, sock)
00362         t = threading.Thread(target=capture_server, args=args)
00363         t.start()
00364         try:
00365             # wait a little longer for the server to initialize (it sometimes
00366             # refuses connections on slow machines without this wait)
00367             time.sleep(0.2)
00368 
00369             data = b"Suppose there isn't a 16-ton weight?"
00370             d = dispatcherwithsend_noread()
00371             d.create_socket(socket.AF_INET, socket.SOCK_STREAM)
00372             d.connect((HOST, port))
00373 
00374             # give time for socket to connect
00375             time.sleep(0.1)
00376 
00377             d.send(data)
00378             d.send(data)
00379             d.send(b'\n')
00380 
00381             n = 1000
00382             while d.out_buffer and n > 0:
00383                 asyncore.poll()
00384                 n -= 1
00385 
00386             evt.wait()
00387 
00388             self.assertEqual(cap.getvalue(), data*2)
00389         finally:
00390             t.join()
00391 

Here is the call graph for this function:


Member Data Documentation

Reimplemented in test.test_asyncore.DispatcherWithSendTests_UsePoll.

Definition at line 343 of file test_asyncore.py.


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