'Assert that errors from mocks propagate to func.
Fail if exceptions raised by mocks are not seen when calling
func(*args, **kwargs). Ensure that we are really seeing exceptions
from the mocks by failing if just running func(*args, **kargs) raises
an exception itself.'

def assert_error_propagates(self, mocks, func, *args, **kwargs):

    func(*args, **kwargs)
    for mock_func in mocks:
        original_side_effect = mock_func.side_effect
        mock_func.side_effect = [exception.PureDriverException(reason='reason')]
        self.assertRaises(exception.PureDriverException, func, *args, **kwargs)
        mock_func.side_effect = original_side_effect
