Skip to content

Commit

Permalink
fix: pass --skip-tasks flag to worker (#1688)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Sigurd Spieckermann <[email protected]>
  • Loading branch information
arnaubt and sisp authored Jul 3, 2024
1 parent 3f89b71 commit 1035e94
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions copier/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def _worker(
vcs_ref=self.vcs_ref,
use_prereleases=self.prereleases,
unsafe=self.unsafe,
skip_tasks=self.skip_tasks,
**kwargs,
)

Expand Down
19 changes: 19 additions & 0 deletions tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
from typing import Literal

import pytest
import yaml

import copier
from copier.cli import CopierApp

from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, build_file_tree

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


@pytest.mark.parametrize("skip_tasks", [False, True])
def test_copy_cli_skip_tasks(
tmp_path_factory: pytest.TempPathFactory,
skip_tasks: bool,
) -> None:
src, dst = map(tmp_path_factory.mktemp, ["src", "dst"])
build_file_tree(
{(src / "copier.yaml"): yaml.safe_dump({"_tasks": ["touch task.txt"]})}
)
_, retcode = CopierApp.run(
["copier", "copy", "--UNSAFE", *(["--skip-tasks"] if skip_tasks else []), str(src), str(dst)],
exit=False,
)
assert retcode == 0
assert (dst / "task.txt").exists() is (not skip_tasks)


def test_pretend_mode(tmp_path_factory: pytest.TempPathFactory) -> None:
src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
build_file_tree(
Expand Down

0 comments on commit 1035e94

Please sign in to comment.