def test_hooks_raises_errors(tmp_path, abort_pre_gen, abort_post_gen) -> None:
    """Verify pre- and pos-gen errors raises correct error code from script.

    This allows developers to make different error codes in their code,
    for different errors.
    """
    context = {
        "cookiecutter": {
            "repo_dir": "foobar",
            "abort_pre_gen": abort_pre_gen,
            "abort_post_gen": abort_post_gen,
        }
    }

    with pytest.raises(exceptions.FailedHookException):
        generate.generate_files(
            repo_dir="tests/hooks-abort-render",
            context=context,
            output_dir=str(tmp_path),
        )
    assert not tmp_path.joinpath("foobar").is_dir()
Verify pre- and pos-gen errors raises correct error code from script.

    This allows developers to make different error codes in their code,
    for different errors.
    
tests/test_abort_generate_on_hook_error.py