test_core.py 文件源码

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

项目:python-diskcache 作者: grantjenks 项目源码 文件源码
def test_get_ioerror_slow_path(cache):
    cache.reset('eviction_policy', 'least-recently-used')
    cache.set(0, 0)

    disk = mock.Mock()
    put = mock.Mock()
    fetch = mock.Mock()

    disk.put = put
    put.side_effect = [(0, True)]
    disk.fetch = fetch
    io_error = IOError()
    io_error.errno = errno.EACCES
    fetch.side_effect = io_error

    with mock.patch.object(cache, '_disk', disk):
        cache.get(0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号