MCPcopy Create free account
hub / github.com/copier-org/copier / test_commit_hash

Function test_commit_hash

tests/test_copy.py:454–470  ·  view source on GitHub ↗
(tmp_path_factory: pytest.TempPathFactory)

Source from the content-addressed store, hash-verified

452
453
454def test_commit_hash(tmp_path_factory: pytest.TempPathFactory) -> None:
455 src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
456 build_file_tree(
457 {
458 src / "commit.jinja": "{{_copier_conf.vcs_ref_hash}}",
459 src / "tag.jinja": "{{_copier_answers._commit}}",
460 }
461 )
462 with local.cwd(src):
463 git("init")
464 git("add", "-A")
465 git("commit", "-m1")
466 git("tag", "1.0")
467 commit = git("rev-parse", "HEAD").strip()
468 copier.run_copy(str(src), dst)
469 assert (dst / "tag").read_text() == "1.0"
470 assert (dst / "commit").read_text() == commit
471
472
473def test_value_with_forward_slash(tmp_path_factory: pytest.TempPathFactory) -> None:

Callers

nothing calls this directly

Calls 2

build_file_treeFunction · 0.85
run_copyMethod · 0.80

Tested by

no test coverage detected