#NEWLINE# def test_connection_wait_for_connection_raises_on_timeout( self ) : #NEWLINE# #INDENT# connection = Connection ( '127.0.0.1' , 'guest' , 'guest' , timeout = 1 , lazy = True ) #NEWLINE# connection . set_state ( self . OPENING ) #NEWLINE# io = IO ( connection . parameters , [ ] ) #NEWLINE# io . socket = MagicMock ( name = 'socket' , spec = socket . socket ) #NEWLINE# connection . _io = io #NEWLINE# self . assertRaises ( AMQPConnectionError , connection . _wait_for_connection_to_open )