def test_cli_with_pre_prompt_hook_fail(cli_runner, monkeypatch) -> None:
    """Test cli invocation will fail when a given env var is present."""
    template_path = 'tests/test-pyhooks/'
    with monkeypatch.context() as m:
        m.setenv('COOKIECUTTER_FAIL_PRE_PROMPT', '1')
        result = cli_runner(template_path, '--no-input')
    assert result.exit_code == 1
    dir_name = 'inputfake-project'
    assert not Path(dir_name).exists()
Test cli invocation will fail when a given env var is present.
tests/test_cli.py