Skip to content

Commit

Permalink
test: template parameter to generate folder copie
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau committed Sep 6, 2023
1 parent a9c2f73 commit e02c659
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_copie.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,29 @@ def test_copie_project(copie):

result = testdir.runpytest("-v", f"--template={copier_template}")
test_check(result, "test_copie_project")


def test_copie_copie_with_template_kwarg(testdir, copier_template, test_check):
"""Copie accepts a template kwarg."""
testdir.makepyfile(
"""
from pathlib import Path
def test_copie_project(copie):
result = copie.copie(
extra_context={"repo_name": "helloworld"},
template=Path("%s"),
)
assert result.exit_code == 0
assert result.exception is None
assert result.project_path.stem == "helloworld"
assert result.project_path.is_dir()
assert str(result) == f"<Result {result.project_path}>"
"""
% copier_template
)

# run pytest without the template cli arg
result = testdir.runpytest("-v")
test_check(result, "test_copie_project")

0 comments on commit e02c659

Please sign in to comment.