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