MCPcopy
hub / github.com/copier-org/copier / template_path

Function template_path

tests/test_subdirectory.py:16–64  ·  view source on GitHub ↗
(tmp_path_factory: pytest.TempPathFactory)

Source from the content-addressed store, hash-verified

14
15@pytest.fixture(scope="module")
16def template_path(tmp_path_factory: pytest.TempPathFactory) -> str:
17 root = tmp_path_factory.mktemp("template")
18 build_file_tree(
19 {
20 (root / "api_project" / "api_readme.md"): "",
21 (root / "api_project" / "[[ _copier_conf.answers_file ]].tmpl"): (
22 "[[ _copier_answers|to_nice_yaml ]]"
23 ),
24 (root / "conf_project" / "conf_readme.md"): (
25 """\
26 # Template subdirectory
27
28 This is the template README.
29 """
30 ),
31 (root / "conf_project" / "conf_readme.md.tmpl"): (
32 """\
33 # Demo subdirectory
34
35 Generated using previous answers `_subdirectory` value.
36 """
37 ),
38 (root / "conf_project" / "[[ _copier_conf.answers_file ]].tmpl"): (
39 "[[ _copier_answers|to_nice_yaml ]]"
40 ),
41 (root / "conf_project" / "[[ filename ]].tmpl"): (
42 "[[ filename ]] contents"
43 ),
44 (root / "copier.yml"): (
45 f"""\
46 _templates_suffix: {SUFFIX_TMPL}
47 _envops: {BRACKET_ENVOPS_JSON}
48 choose_subdir:
49 type: str
50 default: conf_project
51 choices:
52 - api_project
53 - conf_project
54 _subdirectory: "[[ choose_subdir ]]"
55 filename:
56 type: str
57 default: mock_filename
58 """
59 ),
60 }
61 )
62 with local.cwd(root):
63 git_init()
64 return str(root)
65
66
67def test_copy_subdirectory_api_option(template_path: str, tmp_path: Path) -> None:

Callers

nothing calls this directly

Calls 2

build_file_treeFunction · 0.85
git_initFunction · 0.85

Tested by

no test coverage detected