def test_keep_project_dir_on_failure(output_dir, undefined_context) -> None:
    """Verify correct error raised when directory name cannot be rendered."""
    with pytest.raises(exceptions.UndefinedVariableInTemplate):
        generate.generate_files(
            repo_dir='tests/undefined-variable/dir-name/',
            output_dir=output_dir,
            context=undefined_context,
            keep_project_on_failure=True,
        )
    assert Path(output_dir).joinpath('testproject').exists()
Verify correct error raised when directory name cannot be rendered.
tests/test_generate_files.py