#NEWLINE# def test_multi_select( self ) : #NEWLINE# #INDENT# c1 = pycurl . Curl ( ) #NEWLINE# c2 = pycurl . Curl ( ) #NEWLINE# c3 = pycurl . Curl ( ) #NEWLINE# c1 . setopt ( c1 . URL , 'http://localhost:8380/success' ) #NEWLINE# c2 . setopt ( c2 . URL , 'http://localhost:8381/success' ) #NEWLINE# c3 . setopt ( c3 . URL , 'http://localhost:8382/success' ) #NEWLINE# c1 . body = util . StringIO ( ) #NEWLINE# c2 . body = util . StringIO ( ) #NEWLINE# c3 . body = util . StringIO ( ) #NEWLINE# c1 . setopt ( c1 . WRITEFUNCTION , c1 . body . write ) #NEWLINE# c2 . setopt ( c2 . WRITEFUNCTION , c2 . body . write ) #NEWLINE# c3 . setopt ( c3 . WRITEFUNCTION , c3 . body . write ) #NEWLINE# m = pycurl . CurlMulti ( ) #NEWLINE# m . add_handle ( c1 ) #NEWLINE# m . add_handle ( c2 ) #NEWLINE# m . add_handle ( c3 ) #NEWLINE# SELECT_TIMEOUT = 1.0 #NEWLINE# while 1 : #NEWLINE# #INDENT# ( ret , num_handles ) = m . perform ( ) #NEWLINE# if ( ret != pycurl . E_CALL_MULTI_PERFORM ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# while num_handles : #NEWLINE# #INDENT# m . select ( SELECT_TIMEOUT ) #NEWLINE# while 1 : #NEWLINE# #INDENT# ( ret , num_handles ) = m . perform ( ) #NEWLINE# if ( ret != pycurl . E_CALL_MULTI_PERFORM ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# m . remove_handle ( self ) #NEWLINE# m . remove_handle ( c2 ) #NEWLINE# m . remove_handle ( c1 ) #NEWLINE# m . close ( ) #NEWLINE# c1 . close ( ) #NEWLINE# c2 . close ( ) #NEWLINE# c3 . close ( ) #NEWLINE# self . assertEqual ( 'success' , c1 . body . getvalue ( ) ) #NEWLINE# self . assertEqual ( 'success' , c2 . body . getvalue ( ) ) #NEWLINE# self . assertEqual ( 'success' , c3 . body . getvalue ( ) )