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)
评论列表
文章目录