test_session.py 文件源码

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

项目:os-xenapi 作者: openstack 项目源码 文件源码
def test_serialized_with_retry_socket_error_reraised(self):
        exc = socket.error()
        exc.errno = errno.ECONNREFUSED
        plugin = 'glance'
        fn = 'download_vhd'
        num_retries = 1
        callback = None
        retry_cb = mock.Mock()
        with mock.patch.object(
                self.session, 'call_plugin_serialized', spec=True)\
                as call_plugin_serialized:
            call_plugin_serialized.side_effect = exc
            self.assertRaises(
                socket.error, self.session.call_plugin_serialized_with_retry,
                plugin, fn, num_retries, callback, retry_cb)
            call_plugin_serialized.assert_called_once_with(plugin, fn)
            self.assertEqual(0, retry_cb.call_count)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号