python_arptable.py 文件源码

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

项目:sonic-snmpagent 作者: Azure 项目源码 文件源码
def get_arp_table():
    with open(INPUT_DIR + '/arp.txt') as farp:
        file_content = mock_open(read_data = farp.read())
        file_content.return_value.__iter__ = lambda self : iter(self.readline, '')
        # file_content = MagicMock(name = 'open', spec = open)
        # file_content.return_value = iter(farp.readlines())
        with patch('builtins.open', file_content):
            return _get_arp_table()

# Replace the function with mocked one
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号