Skip to content

Commit 22b05bb

Browse files
committed
Update test_template.py
1 parent 882f43c commit 22b05bb

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/test_template.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ def _init_git_repo(path: Path) -> str:
2424
return _git("rev-parse", "HEAD", cwd=path)
2525

2626

27+
def _commit_project(path: Path) -> None:
28+
subprocess.run(["git", "init"], cwd=path, check=True)
29+
subprocess.run(["git", "config", "user.name", "Test User"], cwd=path, check=True)
30+
subprocess.run(
31+
["git", "config", "user.email", "test@example.com"], cwd=path, check=True
32+
)
33+
subprocess.run(["git", "add", "."], cwd=path, check=True)
34+
subprocess.run(["git", "commit", "-m", "Initial commit"], cwd=path, check=True)
35+
36+
2737
def test_template(tmp_path: Path) -> None:
2838
# Path to the Copier template root
2939
template_path = Path(__file__).resolve().parent.parent
@@ -53,6 +63,8 @@ def test_template(tmp_path: Path) -> None:
5363
assert not (dst_path / ".git").exists()
5464
assert not (dst_path / "renovate.json").exists()
5565

66+
_commit_project(dst_path)
67+
5668
# Run pytest from the copied template
5769
subprocess.run(["uv", "run", "pytest"], cwd=dst_path, check=True)
5870

0 commit comments

Comments
 (0)