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

Function test_messages_with_inline_text

tests/test_output.py:95–210  ·  view source on GitHub ↗
(
    tmp_path_factory: pytest.TempPathFactory,
    capsys: pytest.CaptureFixture[str],
    spawn: Spawn,
    interactive: bool,
)

Source from the content-addressed store, hash-verified

93
94@pytest.mark.parametrize("interactive", [False, True])
95def test_messages_with_inline_text(
96 tmp_path_factory: pytest.TempPathFactory,
97 capsys: pytest.CaptureFixture[str],
98 spawn: Spawn,
99 interactive: bool,
100) -> None:
101 src, dst = map(tmp_path_factory.mktemp, ["src", "dst"])
102
103 build_file_tree(
104 {
105 (src / "copier.yaml"): (
106 """\
107 project_name:
108 type: str
109
110 _message_before_copy: Thank you for using our template on {{ _copier_conf.os }}
111 _message_after_copy: Project {{ project_name }} successfully created
112 _message_before_update: Updating on {{ _copier_conf.os }}
113 _message_after_update: Project {{ project_name }} successfully updated
114 """
115 ),
116 (src / "{{ _copier_conf.answers_file }}.jinja"): (
117 """\
118 # Changes here will be overwritten by Copier
119 {{ _copier_answers|to_nice_yaml }}
120 """
121 ),
122 (src / "version.txt"): "v1",
123 }
124 )
125 with local.cwd(src):
126 git("init")
127 git("add", ".")
128 git("commit", "-m1")
129 git("tag", "v1")
130
131 build_file_tree(
132 {
133 (src / "version.txt"): "v2",
134 }
135 )
136 with local.cwd(src):
137 git("add", ".")
138 git("commit", "-m2")
139 git("tag", "v2")
140
141 # clear capture output log
142 capsys.readouterr()
143
144 # copy
145 if interactive:
146 tui = spawn(COPIER_PATH + ("copy", "-r", "v1", str(src), str(dst)))
147 expect_prompt(tui, "project_name", "str")
148 tui.sendline("myproj")
149 tui.expect_exact(pexpect.EOF)
150 else:
151 run_copy(str(src), dst, data={"project_name": "myproj"}, vcs_ref="v1")
152

Callers

nothing calls this directly

Calls 6

run_copyFunction · 0.90
run_recopyFunction · 0.90
run_updateFunction · 0.90
build_file_treeFunction · 0.85
spawnFunction · 0.85
expect_promptFunction · 0.85

Tested by

no test coverage detected