you can just set the `side_effect` to be the exception (instance) to get this behaviour

    mock.side_effect = OSError()