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

Function test_updatediff

tests/test_updatediff.py:36–302  ·  view source on GitHub ↗
(tmp_path_factory: pytest.TempPathFactory)

Source from the content-addressed store, hash-verified

34
35@pytest.mark.impure
36def test_updatediff(tmp_path_factory: pytest.TempPathFactory) -> None:
37 src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
38 # Prepare repo bundle
39 repo = src / "repo"
40 bundle = src / "demo_updatediff_repo.bundle"
41 last_commit = ""
42 build_file_tree(
43 {
44 (repo / ".copier-answers.yml.jinja"): (
45 """\
46 # Changes here will be overwritten by Copier
47 {{ _copier_answers|to_nice_yaml }}
48 """
49 ),
50 (repo / "copier.yml"): (
51 """\
52 _envops:
53 "keep_trailing_newline": True
54 project_name: to become a pirate
55 author_name: Guybrush
56 """
57 ),
58 (repo / "README.txt.jinja"): (
59 """
60 Let me introduce myself.
61
62 My name is {{author_name}}, and my project is {{project_name}}.
63
64 Thanks for your attention.
65 """
66 ),
67 }
68 )
69 with local.cwd(repo):
70 git("init")
71 git("add", ".")
72 git("commit", "-m", "Guybrush wants to be a pirate")
73 git("tag", "v0.0.1")
74 build_file_tree(
75 {
76 (repo / "copier.yml"): (
77 """\
78 _envops:
79 "keep_trailing_newline": True
80 project_name: to become a pirate
81 author_name: Guybrush
82 _migrations:
83 - version: v0.0.1
84 when: "{{ _stage == 'before' }}"
85 command: touch before-v0.0.1
86 - version: v0.0.1
87 when: "{{ _stage == 'after' }}"
88 command: touch after-v0.0.1
89 - version: v0.0.2
90 when: "{{ _stage == 'before' }}"
91 command: touch before-v0.0.2
92 - version: v0.0.2
93 when: "{{ _stage == 'after' }}"

Callers

nothing calls this directly

Calls 5

load_answersfile_dataFunction · 0.90
run_updateFunction · 0.90
WorkerClass · 0.90
build_file_treeFunction · 0.85
run_copyMethod · 0.80

Tested by

no test coverage detected