diff --git a/copier/__init__.py b/copier/__init__.py index 664a838fb..80e92eb7f 100644 --- a/copier/__init__.py +++ b/copier/__init__.py @@ -3,7 +3,7 @@ Docs: https://copier.readthedocs.io/ """ -from .main import * # noqa: F401,F403 +from .main import * # noqa: F403 # This version is a placeholder autoupdated by poetry-dynamic-versioning __version__ = "0.0.0" diff --git a/copier/main.py b/copier/main.py index 29c671d71..c11fcdda4 100644 --- a/copier/main.py +++ b/copier/main.py @@ -765,7 +765,7 @@ def run_copy(self) -> None: self._render_folder(src_abspath) if not self.quiet: # TODO Unify printing tools - print("") # padding space + print() # padding space self._execute_tasks(self.template.tasks) except Exception: if not was_existing and self.cleanup_on_error: @@ -774,7 +774,7 @@ def run_copy(self) -> None: self._print_message(self.template.message_after_copy) if not self.quiet: # TODO Unify printing tools - print("") # padding space + print() # padding space def run_recopy(self) -> None: """Update a subproject, keeping answers but discarding evolution.""" diff --git a/copier/template.py b/copier/template.py index b4b808f18..18bc67eb7 100644 --- a/copier/template.py +++ b/copier/template.py @@ -243,7 +243,7 @@ def _raw_config(self) -> AnyByStrDict: conf_paths = [ p for p in self.local_abspath.glob("copier.*") - if p.is_file() and re.match(r"\.ya?ml", p.suffix, re.I) + if p.is_file() and re.match(r"\.ya?ml", p.suffix, re.IGNORECASE) ] if len(conf_paths) > 1: raise MultipleConfigFilesError(conf_paths) diff --git a/copier/tools.py b/copier/tools.py index 23077a83a..b1507c4a7 100644 --- a/copier/tools.py +++ b/copier/tools.py @@ -1,4 +1,5 @@ """Some utility functions.""" + from __future__ import annotations import errno @@ -13,7 +14,7 @@ from importlib.metadata import version from pathlib import Path from types import TracebackType -from typing import Any, Callable, Literal, TextIO, cast +from typing import Any, Callable, ClassVar, Literal, TextIO, cast import colorama from packaging.version import Version @@ -25,11 +26,11 @@ class Style: """Common color styles.""" - OK = [colorama.Fore.GREEN, colorama.Style.BRIGHT] - WARNING = [colorama.Fore.YELLOW, colorama.Style.BRIGHT] - IGNORE = [colorama.Fore.CYAN] - DANGER = [colorama.Fore.RED, colorama.Style.BRIGHT] - RESET = [colorama.Fore.RESET, colorama.Style.RESET_ALL] + OK: ClassVar[list[str]] = [colorama.Fore.GREEN, colorama.Style.BRIGHT] + WARNING: ClassVar[list[str]] = [colorama.Fore.YELLOW, colorama.Style.BRIGHT] + IGNORE: ClassVar[list[str]] = [colorama.Fore.CYAN] + DANGER: ClassVar[list[str]] = [colorama.Fore.RED, colorama.Style.BRIGHT] + RESET: ClassVar[list[str]] = [colorama.Fore.RESET, colorama.Style.RESET_ALL] INDENT = " " * 2 @@ -75,7 +76,7 @@ def printf( if not style: return action + _msg - out = style + [action] + Style.RESET + [INDENT, _msg] + out = [*style, action, *Style.RESET, INDENT, _msg] print(*out, sep="", file=file_) return None @@ -85,7 +86,7 @@ def printf_exception( ) -> None: """Print exception with common format.""" if not quiet: - print("", file=sys.stderr) + print(file=sys.stderr) printf(action, msg=msg, style=Style.DANGER, indent=indent, file_=sys.stderr) print(HLINE, file=sys.stderr) print(e, file=sys.stderr) diff --git a/copier/user_data.py b/copier/user_data.py index 8d5c1cca9..f655b6c0c 100644 --- a/copier/user_data.py +++ b/copier/user_data.py @@ -316,9 +316,9 @@ def _formatted_choices(self) -> Sequence[Choice]: # The value can be templated value = self.render_value(value) checked = ( - self.multiselect + (self.multiselect and isinstance(default, list) - and self.cast_answer(value) in default + and self.cast_answer(value) in default) or None ) c = Choice(name, value, disabled=disabled, checked=checked) diff --git a/copier/vcs.py b/copier/vcs.py index 092259f27..e354d1c69 100644 --- a/copier/vcs.py +++ b/copier/vcs.py @@ -76,10 +76,11 @@ def is_git_bundle(path: Path) -> bool: """Indicate if a path is a valid git bundle.""" with suppress(OSError): path = path.resolve() - with TemporaryDirectory(prefix=f"{__name__}.is_git_bundle.") as dirname: - with local.cwd(dirname): - get_git()("init") - return bool(get_git()["bundle", "verify", path] & TF) + with TemporaryDirectory(prefix=f"{__name__}.is_git_bundle.") as dirname, local.cwd( + dirname + ): + get_git()("init") + return bool(get_git()["bundle", "verify", path] & TF) def get_repo(url: str) -> str | None: @@ -105,7 +106,7 @@ def get_repo(url: str) -> str | None: if url.startswith("git+"): url = url[4:] elif url.startswith("https://") and not url.endswith(GIT_POSTFIX): - url = "".join((url, GIT_POSTFIX)) + url = f"{url}{GIT_POSTFIX}" return url url_path = Path(url) @@ -168,10 +169,7 @@ def clone(url: str, ref: str | None = None) -> str: # Faster clones if possible if git_version >= Version("2.27"): url_match = re.match("(file://)?(.*)", url) - if url_match is not None: - file_url = url_match.groups()[-1] - else: - file_url = url + file_url = url_match.groups()[-1] if url_match is not None else url if is_git_shallow_repo(file_url): warn( f"The repository '{url}' is a shallow clone, this might lead to unexpected " diff --git a/devtasks.py b/devtasks.py index e92ddfc96..019ee539b 100644 --- a/devtasks.py +++ b/devtasks.py @@ -1,4 +1,5 @@ """Development helper tasks.""" + import logging import shutil from pathlib import Path @@ -25,7 +26,7 @@ def clean() -> None: "**/*.pyc", "**/*.pyo", ) - project_dir = Path(".").resolve() + project_dir = Path.cwd() for pattern in build_artefacts + python_artefacts: for matching_path in project_dir.glob(pattern): print(f"Deleting {matching_path}") diff --git a/pyproject.toml b/pyproject.toml index c0b46100d..a2a6ea63c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -115,13 +115,19 @@ extend-select = [ "ARG", "B", "C90", + "C4", "D", "E", "F", "FA", + "FLY", + "FURB", "I", "PERF", + "PIE", "PGH", + "RUF", + "SIM", "UP", ] extend-ignore = ['B028', "B904", "D105", "D107", "E501"] diff --git a/tests/test_complex_questions.py b/tests/test_complex_questions.py index 8e61cbfa6..893313013 100644 --- a/tests/test_complex_questions.py +++ b/tests/test_complex_questions.py @@ -169,7 +169,7 @@ def test_api(template_path: str, tmp_path: Path) -> None: def test_cli_interactive(template_path: str, tmp_path: Path, spawn: Spawn) -> None: """Test copier correctly processes advanced questions and answers through CLI.""" - tui = spawn(COPIER_PATH + ("copy", template_path, str(tmp_path)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", template_path, str(tmp_path)), timeout=10) expect_prompt(tui, "love_me", "bool", help="I need to know it. Do you love me?") tui.send("y") expect_prompt(tui, "your_name", "str", help="Please tell me your name.") @@ -311,16 +311,7 @@ def test_cli_interatively_with_flag_data_and_type_casts( ) -> None: """Assert how choices work when copier is invoked with --data interactively.""" tui = spawn( - COPIER_PATH - + ( - "copy", - "--data=choose_list=second", - "--data=choose_dict=first", - "--data=choose_tuple=third", - "--data=choose_number=1", - template_path, - str(tmp_path), - ), + (*COPIER_PATH, "copy", "--data=choose_list=second", "--data=choose_dict=first", "--data=choose_tuple=third", "--data=choose_number=1", template_path, str(tmp_path)), timeout=10, ) expect_prompt(tui, "love_me", "bool", help="I need to know it. Do you love me?") @@ -406,7 +397,7 @@ def test_tui_inherited_default( git("add", "--all") git("commit", "--message", "init template") git("tag", "1") - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "owner1", "str") tui.sendline("example") expect_prompt(tui, "has_2_owners", "bool") @@ -465,7 +456,7 @@ def test_tui_typed_default( ), } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) tui.expect_exact(pexpect.EOF) assert json.loads((dst / "answers.json").read_text()) == {"_src_path": str(src)} assert json.loads((dst / "context.json").read_text()) == { @@ -506,7 +497,7 @@ def test_selection_type_cast( (src / "answers.json.jinja"): "{{ _copier_answers|to_json }}", } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt( tui, "postgres1", "yaml", help="Which PostgreSQL version do you want to deploy?" ) diff --git a/tests/test_conditional_file_name.py b/tests/test_conditional_file_name.py index 4c19941aa..a98d23de6 100644 --- a/tests/test_conditional_file_name.py +++ b/tests/test_conditional_file_name.py @@ -84,7 +84,7 @@ def test_answer_changes( git("tag", "v1") if interactive: - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "condition", "bool") tui.expect_exact("(y/N)") tui.sendline("y") @@ -101,7 +101,7 @@ def test_answer_changes( git("commit", "-mv1") if interactive: - tui = spawn(COPIER_PATH + ("update", str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "update", str(dst)), timeout=10) expect_prompt(tui, "condition", "bool") tui.expect_exact("(Y/n)") tui.sendline("n") diff --git a/tests/test_config.py b/tests/test_config.py index a5f00f7c8..f117e2507 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -295,7 +295,7 @@ def test_missing_template(tmp_path: Path) -> None: def is_subdict(small: dict[Any, Any], big: dict[Any, Any]) -> bool: - return {**big, **small} == big + return big == {**big, **small} def test_worker_good_data(tmp_path: Path) -> None: @@ -316,7 +316,7 @@ def test_worker_good_data(tmp_path: Path) -> None: # func_args > defaults ( {"src_path": ".", "exclude": ["aaa"]}, - tuple(DEFAULT_EXCLUDE) + ("aaa",), + (*DEFAULT_EXCLUDE, "aaa"), ), # func_args > user_data ( diff --git a/tests/test_interrupts.py b/tests/test_interrupts.py index d9b17d071..08a553c5a 100644 --- a/tests/test_interrupts.py +++ b/tests/test_interrupts.py @@ -34,9 +34,10 @@ def test_keyboard_interrupt( ) worker = Worker(str(src), dst, defaults=False) - with patch("copier.main.unsafe_prompt", side_effect=side_effect): - with pytest.raises(KeyboardInterrupt): - worker.run_copy() + with patch("copier.main.unsafe_prompt", side_effect=side_effect), pytest.raises( + KeyboardInterrupt + ): + worker.run_copy() def test_multiple_questions_interrupt(tmp_path_factory: pytest.TempPathFactory) -> None: diff --git a/tests/test_output.py b/tests/test_output.py index f33abf604..995fd7ccf 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -146,7 +146,7 @@ def test_messages_with_inline_text( # copy if interactive: - tui = spawn(COPIER_PATH + ("copy", "-r", "v1", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", "-r", "v1", str(src), str(dst)), timeout=10) expect_prompt(tui, "project_name", "str") tui.sendline("myproj") tui.expect_exact(pexpect.EOF) @@ -161,12 +161,12 @@ def test_messages_with_inline_text( Project\ myproj\ successfully\ created\s*$ """, err, - flags=re.S | re.X, + flags=re.DOTALL | re.VERBOSE, ) # recopy if interactive: - tui = spawn(COPIER_PATH + ("recopy", "-r", "v1", str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "recopy", "-r", "v1", str(dst)), timeout=10) expect_prompt(tui, "project_name", "str") tui.sendline("_new") tui.expect_exact(pexpect.EOF) @@ -181,7 +181,7 @@ def test_messages_with_inline_text( Project\ myproj_new\ successfully\ created\s*$ """, err, - flags=re.S | re.X, + flags=re.DOTALL | re.VERBOSE, ) with local.cwd(dst): @@ -194,7 +194,7 @@ def test_messages_with_inline_text( # update if interactive: - tui = spawn(COPIER_PATH + ("update", str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "update", str(dst)), timeout=10) expect_prompt(tui, "project_name", "str") tui.sendline("_update") tui.expect_exact(pexpect.EOF) @@ -209,7 +209,7 @@ def test_messages_with_inline_text( Project\ myproj_new_update\ successfully\ updated\s*$ """, err, - flags=re.S | re.X, + flags=re.DOTALL | re.VERBOSE, ) @@ -286,7 +286,7 @@ def test_messages_with_included_text( # copy if interactive: - tui = spawn(COPIER_PATH + ("copy", "-r", "v1", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", "-r", "v1", str(src), str(dst)), timeout=10) expect_prompt(tui, "project_name", "str") tui.sendline("myproj") tui.expect_exact(pexpect.EOF) @@ -301,12 +301,12 @@ def test_messages_with_included_text( Project\ myproj\ successfully\ created\s*$ """, err, - flags=re.S | re.X, + flags=re.DOTALL | re.VERBOSE, ) # recopy if interactive: - tui = spawn(COPIER_PATH + ("recopy", "-r", "v1", str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "recopy", "-r", "v1", str(dst)), timeout=10) expect_prompt(tui, "project_name", "str") tui.sendline("_new") tui.expect_exact(pexpect.EOF) @@ -321,7 +321,7 @@ def test_messages_with_included_text( Project\ myproj_new\ successfully\ created\s*$ """, err, - flags=re.S | re.X, + flags=re.DOTALL | re.VERBOSE, ) with local.cwd(dst): @@ -334,7 +334,7 @@ def test_messages_with_included_text( # update if interactive: - tui = spawn(COPIER_PATH + ("update", str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "update", str(dst)), timeout=10) expect_prompt(tui, "project_name", "str") tui.sendline("_update") tui.expect_exact(pexpect.EOF) @@ -349,7 +349,7 @@ def test_messages_with_included_text( Project\ myproj_new_update\ successfully\ updated\s*$ """, err, - flags=re.S | re.X, + flags=re.DOTALL | re.VERBOSE, ) @@ -406,7 +406,7 @@ def test_messages_quiet( # copy if interactive: tui = spawn( - COPIER_PATH + ("copy", "--quiet", "-r", "v1", str(src), str(dst)), + (*COPIER_PATH, "copy", "--quiet", "-r", "v1", str(src), str(dst)), timeout=10, ) expect_prompt(tui, "project_name", "str") @@ -425,7 +425,7 @@ def test_messages_quiet( # recopy if interactive: tui = spawn( - COPIER_PATH + ("recopy", "--quiet", "-r", "v1", str(dst)), timeout=10 + (*COPIER_PATH, "recopy", "--quiet", "-r", "v1", str(dst)), timeout=10 ) expect_prompt(tui, "project_name", "str") tui.sendline("_new") @@ -448,7 +448,7 @@ def test_messages_quiet( # update if interactive: - tui = spawn(COPIER_PATH + ("update", "--quiet", str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "update", "--quiet", str(dst)), timeout=10) expect_prompt(tui, "project_name", "str") tui.sendline("_update") tui.expect_exact(pexpect.EOF) diff --git a/tests/test_prompt.py b/tests/test_prompt.py index 7346cdb0c..26b8feb40 100644 --- a/tests/test_prompt.py +++ b/tests/test_prompt.py @@ -110,7 +110,7 @@ def test_copy_default_advertised( with local.cwd(dst): # Copy the v1 template tui = spawn( - COPIER_PATH + ("copy", str(src), ".", "--vcs-ref=v1") + args, timeout=10 + (*COPIER_PATH, "copy", str(src), ".", "--vcs-ref=v1", *args), timeout=10 ) # Check what was captured expect_prompt(tui, "in_love", "bool") @@ -134,7 +134,7 @@ def test_copy_default_advertised( # Update subproject git_save() assert "_commit: v1" in Path(".copier-answers.yml").read_text() - tui = spawn(COPIER_PATH + ("update",), timeout=30) + tui = spawn((*COPIER_PATH, "update"), timeout=30) # Check what was captured expect_prompt(tui, "in_love", "bool") tui.expect_exact("(Y/n)") @@ -178,7 +178,7 @@ def test_update_skip_answered( with local.cwd(dst): # Copy the v1 template tui = spawn( - COPIER_PATH + ("copy", str(src), ".", "--vcs-ref=v1") + args, timeout=10 + (*COPIER_PATH, "copy", str(src), ".", "--vcs-ref=v1", *args), timeout=10 ) # Check what was captured expect_prompt(tui, "in_love", "bool") @@ -202,11 +202,7 @@ def test_update_skip_answered( # Update subproject git_save() tui = spawn( - COPIER_PATH - + ( - update_action, - "--skip-answered", - ), + (*COPIER_PATH, update_action, "--skip-answered"), timeout=30, ) # Check what was captured @@ -241,7 +237,7 @@ def test_update_with_new_field_in_new_version_skip_answered( with local.cwd(dst): # Copy the v1 template tui = spawn( - COPIER_PATH + ("copy", str(src), ".", "--vcs-ref=v1") + args, timeout=10 + (*COPIER_PATH, "copy", str(src), ".", "--vcs-ref=v1", *args), timeout=10 ) # Check what was captured expect_prompt(tui, "in_love", "bool") @@ -265,11 +261,7 @@ def test_update_with_new_field_in_new_version_skip_answered( # Update subproject git_save() tui = spawn( - COPIER_PATH - + ( - "update", - "-A", - ), + (*COPIER_PATH, "update", "-A"), timeout=30, ) # Check what was captured @@ -356,7 +348,7 @@ def test_when( ), } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "question_1", type(question_1).__name__) tui.sendline() if asks: @@ -394,7 +386,7 @@ def test_placeholder(tmp_path_factory: pytest.TempPathFactory, spawn: Spawn) -> ), } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "question_1", "str") tui.expect_exact("answer 1") tui.sendline() @@ -439,7 +431,7 @@ def test_multiline( ), } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "question_1", "str") tui.expect_exact("answer 1") tui.sendline() @@ -514,7 +506,7 @@ def test_update_choice( git("commit", "-m one") git("tag", "v1") # Copy - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "pick_one", "float") tui.sendline(Keyboard.Up) tui.expect_exact(pexpect.EOF) @@ -526,11 +518,7 @@ def test_update_choice( git("commit", "-m1") # Update tui = spawn( - COPIER_PATH - + ( - "update", - str(dst), - ), + (*COPIER_PATH, "update", str(dst)), timeout=10, ) expect_prompt(tui, "pick_one", "float") @@ -575,7 +563,7 @@ def test_multiline_defaults( ), } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "yaml_single", "yaml") # This test will always fail here, because python prompt toolkit gives # syntax highlighting to YAML and JSON outputs, encoded into terminal @@ -620,7 +608,7 @@ def test_partial_interrupt( ), } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "question_1", "str") tui.expect_exact("answer 1") # Answer the first question using the default. @@ -660,7 +648,7 @@ def test_var_name_value_allowed( } ) # Copy - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "value", "str") tui.expect_exact("string") tui.send(Keyboard.Alt + Keyboard.Enter) @@ -701,7 +689,7 @@ def test_required_text_question( ), } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "question", type_name) tui.expect_exact("") tui.sendline() @@ -735,7 +723,7 @@ def test_required_bool_question( ), } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "question", "bool") tui.expect_exact("(y/N)") tui.sendline() @@ -782,7 +770,7 @@ def test_required_choice_question( ), } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "question", type_name) tui.sendline() tui.expect_exact(pexpect.EOF) diff --git a/tests/test_templated_prompt.py b/tests/test_templated_prompt.py index 84e3543c6..beb9f1c1e 100644 --- a/tests/test_templated_prompt.py +++ b/tests/test_templated_prompt.py @@ -166,7 +166,7 @@ def test_templated_prompt( ), } ) - tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", str(src), str(dst)), timeout=10) expect_prompt(tui, "main", "str") tui.expect_exact(main_default) tui.sendline() @@ -356,7 +356,7 @@ def test_templated_prompt_with_conditional_choices( } ) tui = spawn( - COPIER_PATH + ("copy", f"--data=cloud={cloud}", str(src), str(dst)), + (*COPIER_PATH, "copy", f"--data=cloud={cloud}", str(src), str(dst)), timeout=10, ) expect_prompt(tui, "iac", "str", help="Which IaC tool do you use?") diff --git a/tests/test_unsafe.py b/tests/test_unsafe.py index e501edb17..584f8383d 100644 --- a/tests/test_unsafe.py +++ b/tests/test_unsafe.py @@ -345,7 +345,7 @@ def test_update_cli( git("tag", "v1") _, retcode = CopierApp.run( - ["copier", "copy", str(src), str(dst)] + unsafe_args, + ["copier", "copy", str(src), str(dst), *unsafe_args], exit=False, ) assert retcode == 0 @@ -368,12 +368,7 @@ def test_update_cli( git("tag", "v2") _, retcode = CopierApp.run( - [ - "copier", - "update", - str(dst), - ] - + unsafe_args, + ["copier", "update", str(dst), *unsafe_args], exit=False, ) if unsafe: diff --git a/tests/test_updatediff.py b/tests/test_updatediff.py index 263ae9fb2..ee70bc6de 100644 --- a/tests/test_updatediff.py +++ b/tests/test_updatediff.py @@ -726,7 +726,7 @@ def test_update_inline_changed_answers_and_questions( git("tag", "2") # Init project if interactive: - tui = spawn(COPIER_PATH + ("copy", "-r1", str(src), str(dst)), timeout=10) + tui = spawn((*COPIER_PATH, "copy", "-r1", str(src), str(dst)), timeout=10) tui.expect_exact("b (bool)") tui.expect_exact("(y/N)") tui.send("y") @@ -752,7 +752,7 @@ def test_update_inline_changed_answers_and_questions( git("commit", "-am2") # Update from template, inline, with answer changes if interactive: - tui = spawn(COPIER_PATH + ("update", "--conflict=inline"), timeout=10) + tui = spawn((*COPIER_PATH, "update", "--conflict=inline"), timeout=10) tui.expect_exact("b (bool)") tui.expect_exact("(Y/n)") tui.sendline()