File: test_cookiecutter_nested_templates.py

package info (click to toggle)
cookiecutter 2.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,780 kB
  • sloc: python: 6,097; makefile: 113; sh: 8
file content (23 lines) | stat: -rw-r--r-- 793 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Test cookiecutter invocation with nested configuration structure."""

from pathlib import Path

import pytest

from cookiecutter import main


@pytest.mark.parametrize(
    "template_dir,output_dir",
    [
        ["fake-nested-templates", "fake-project"],
        ["fake-nested-templates-old-style", "fake-package"],
    ],
)
def test_cookiecutter_nested_templates(mocker, template_dir: str, output_dir: str):
    """Verify cookiecutter nested configuration files mechanism."""
    mock_generate_files = mocker.patch("cookiecutter.main.generate_files")
    main_dir = (Path("tests") / template_dir).resolve()
    main.cookiecutter(f"{main_dir}", no_input=True)
    expected = (Path(main_dir) / output_dir).resolve()
    assert mock_generate_files.call_args[1]["repo_dir"] == f"{expected}"