def test_pop_ioerror_eacces(cache):
assert 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.pop(0)
评论列表
文章目录