test_detect.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:maas 作者: maas 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号