@pytest.mark.parametrize('error_message', ["error: pathspec 'unknown_branch' did not match any file(s) known to git.", "hg: abort: unknown revision 'unknown_branch'!"])
def test_clone_handles_branch_typo(mocker, clone_dir, error_message):
 mocker.patch('cookiecutter.vcs.subprocess.check_output', autospec=True, side_effect=[subprocess.CalledProcessError((-1), 'cmd', output=error_message)])
 repository_url = 'https://github.com/pytest-dev/cookiecutter-pytest-plugin'
 with pytest.raises(exceptions.RepositoryCloneFailed) as err:
  vcs.clone(repository_url, clone_to_dir=clone_dir, checkout='unknown_branch', no_input=True)
 assert (str(err.value) == 'The unknown_branch branch of repository {} could not found, have you made a typo?'.format(repository_url))

@ pytest . mark . parametrize ( 'error_message' , [ "error: pathspec 'unknown_branch' did not match any file(s) known to git." , "hg: abort: unknown revision 'unknown_branch'!" ] ) def test_clone_handles_branch_typo ( mocker , clone_dir , error_message ) : mocker . patch ( 'cookiecutter.vcs.subprocess.check_output' , autospec = True , side_effect = [ subprocess . CalledProcessError ( ( - 1 ) , 'cmd' , output = error_message ) ] ) repository_url = 'https://github.com/pytest-dev/cookiecutter-pytest-plugin' with pytest . raises ( exceptions . RepositoryCloneFailed ) as err : vcs . clone ( repository_url , clone_to_dir = clone_dir , checkout = 'unknown_branch' , no_input = True ) assert ( str ( err . value ) == 'The unknown_branch branch of repository {} could not found, have you made a typo?' . format ( repository_url ) )
in clone() .