'Test with subprocess.check_output raising an exception.
Args:
exc: The exception to raise.'

@pytest.mark.parametrize('exc', [OSError, subprocess.CalledProcessError(1, 'foobar')])
def test_exception(self, exc, mocker, tmpdir):

    m = mocker.patch('qutebrowser.utils.version.os')
    m.path.isdir.return_value = True
    mocker.patch('qutebrowser.utils.version.subprocess.check_output', side_effect=exc)
    ret = version._git_str_subprocess(str(tmpdir))
    assert (ret is None)
