(
tmp_path_factory: pytest.TempPathFactory,
capsys: pytest.CaptureFixture[str],
spawn: Spawn,
interactive: bool,
)
| 93 | |
| 94 | @pytest.mark.parametrize("interactive", [False, True]) |
| 95 | def 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 |
nothing calls this directly
no test coverage detected