Skip to content

Commit 1035e94

Browse files
arnaubtsisp
andauthored
fix: pass --skip-tasks flag to worker (#1688)
--------- Co-authored-by: Sigurd Spieckermann <[email protected]>
1 parent 3f89b71 commit 1035e94

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

copier/cli.py

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def _worker(
222222
vcs_ref=self.vcs_ref,
223223
use_prereleases=self.prereleases,
224224
unsafe=self.unsafe,
225+
skip_tasks=self.skip_tasks,
225226
**kwargs,
226227
)
227228

tests/test_tasks.py

+19
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
from typing import Literal
55

66
import pytest
7+
import yaml
78

89
import copier
10+
from copier.cli import CopierApp
911

1012
from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, build_file_tree
1113

@@ -82,6 +84,23 @@ def test_copy_skip_tasks(template_path: str, tmp_path: Path) -> None:
8284
assert not (tmp_path / "pyfile").is_file()
8385

8486

87+
@pytest.mark.parametrize("skip_tasks", [False, True])
88+
def test_copy_cli_skip_tasks(
89+
tmp_path_factory: pytest.TempPathFactory,
90+
skip_tasks: bool,
91+
) -> None:
92+
src, dst = map(tmp_path_factory.mktemp, ["src", "dst"])
93+
build_file_tree(
94+
{(src / "copier.yaml"): yaml.safe_dump({"_tasks": ["touch task.txt"]})}
95+
)
96+
_, retcode = CopierApp.run(
97+
["copier", "copy", "--UNSAFE", *(["--skip-tasks"] if skip_tasks else []), str(src), str(dst)],
98+
exit=False,
99+
)
100+
assert retcode == 0
101+
assert (dst / "task.txt").exists() is (not skip_tasks)
102+
103+
85104
def test_pretend_mode(tmp_path_factory: pytest.TempPathFactory) -> None:
86105
src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
87106
build_file_tree(

0 commit comments

Comments
 (0)