def test__no_ip_raises_ipaddressnotavailable(self):
mock_ioerror = IOError()
mock_ioerror.errno = errno.EADDRNOTAVAIL
self.patch(detect_module.fcntl, 'ioctl').side_effect = mock_ioerror
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
with ExpectedException(
IPAddressNotAvailable, '.*No IP address.*'):
get_interface_ip(sock, 'lo')
评论列表
文章目录