@mock.patch('socket.socket')
def test_verify_port_in_use(self, fake_socket):
    s = mock.MagicMock()
    s.bind.side_effect = socket.error()
    fake_socket.return_value = s
    self.assertRaises(exception.SocketPortInUseException, serial._verify_port, '127.0.0.1', 10)
    s.bind.assert_called_once_with(('127.0.0.1', 10))
@mock.patch('socket.socket')
def test_verify_port_in_use(self, fake_socket):
    s = mock.MagicMock()
    s.bind.side_effect = socket.error()
    fake_socket.return_value = s
    self.assertRaises(exception.SocketPortInUseException, serial._verify_port, '127.0.0.1', 10)
    s.bind.assert_called_once_with(('127.0.0.1', 10))