From adfdfb185c1596670701a1bd0763efd99b46dcf7 Mon Sep 17 00:00:00 2001 From: Sebastien Crocquevieille Date: Wed, 26 Oct 2022 04:43:37 +0200 Subject: [PATCH 1/8] feat(cli.py): Added support for extra git CLI args after -- separator for `cz commit` command Additional edits were made in class `commitizen.commands.Commit` and `commit` func from `commitizen.git` Closes #451 --- commitizen/cli.py | 23 +++++++++++++++++++++-- commitizen/commands/commit.py | 3 +++ commitizen/git.py | 4 ++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/commitizen/cli.py b/commitizen/cli.py index 7f4d4893c0..a241dd4bcb 100644 --- a/commitizen/cli.py +++ b/commitizen/cli.py @@ -15,6 +15,7 @@ CommitizenException, ExitCode, ExpectedExit, + InvalidCommandArgumentError, NoCommandFoundError, ) @@ -441,7 +442,7 @@ def main(): # This is for the command required constraint in 2.0 try: - args = parser.parse_args() + args, unknown_args = parser.parse_known_args() except (TypeError, SystemExit) as e: # https://github.com/commitizen-tools/commitizen/issues/429 # argparse raises TypeError when non exist command is provided on Python < 3.9 @@ -450,6 +451,24 @@ def main(): raise NoCommandFoundError() raise e + arguments = vars(args) + if unknown_args: + # Raise error for extra-args without -- separation + if "--" not in unknown_args: + raise InvalidCommandArgumentError( + f"Invalid commitizen arguments were found: `{' '.join(unknown_args)}`. " + "Please use -- separator for extra git args" + ) + # Raise error for extra-args before -- + elif unknown_args[0] != "--": + pos = unknown_args.index("--") + raise InvalidCommandArgumentError( + f"Invalid commitizen arguments were found before -- separator: `{' '.join(unknown_args[:pos])}`. " + ) + # TODO: treat case when extra-args and commitizen args are identical + extra_args = " ".join(unknown_args[1:]) + arguments["extra_cli_args"] = extra_args + if args.name: conf.update({"name": args.name}) elif not args.name and not conf.path: @@ -465,7 +484,7 @@ def main(): ) sys.excepthook = no_raise_debug_excepthook - args.func(conf, vars(args))() + args.func(conf, arguments)() if __name__ == "__main__": diff --git a/commitizen/commands/commit.py b/commitizen/commands/commit.py index 39cab33b5c..a60a31e257 100644 --- a/commitizen/commands/commit.py +++ b/commitizen/commands/commit.py @@ -99,6 +99,9 @@ def __call__(self): if signoff: c = git.commit(m, "-s") + + if self.arguments.get("extra_cli_args"): + c = git.commit(m, extra_args=self.arguments.get("extra_cli_args")) else: c = git.commit(m) diff --git a/commitizen/git.py b/commitizen/git.py index 67652b9516..2565ad8296 100644 --- a/commitizen/git.py +++ b/commitizen/git.py @@ -98,13 +98,13 @@ def add(args: str = "") -> cmd.Command: def commit( - message: str, args: str = "", committer_date: str | None = None + message: str, args: str = "", extra_args: str = "", committer_date: str | None = None ) -> cmd.Command: f = NamedTemporaryFile("wb", delete=False) f.write(message.encode("utf-8")) f.close() - command = f"git commit {args} -F {f.name}" + command = cmd.run(f"git commit {args} {extra_args} -F {f.name}") if committer_date and os.name == "nt": # pragma: no cover # Using `cmd /v /c "{command}"` sets environment variables only for that command From 5888f37a85ba81f79c667eeda5e11380cba01ac4 Mon Sep 17 00:00:00 2001 From: SCrocky Date: Sat, 26 Nov 2022 18:59:15 +0800 Subject: [PATCH 2/8] refactor(Commit): Added deprecation on git signoff mechanic Signoff dedicated code is no longer necessary & removed #TODO as tests show identical args and extra-args are not an issue. --- commitizen/cli.py | 1 - commitizen/commands/commit.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/commitizen/cli.py b/commitizen/cli.py index a241dd4bcb..de1d3ba8a8 100644 --- a/commitizen/cli.py +++ b/commitizen/cli.py @@ -465,7 +465,6 @@ def main(): raise InvalidCommandArgumentError( f"Invalid commitizen arguments were found before -- separator: `{' '.join(unknown_args[:pos])}`. " ) - # TODO: treat case when extra-args and commitizen args are identical extra_args = " ".join(unknown_args[1:]) arguments["extra_cli_args"] = extra_args diff --git a/commitizen/commands/commit.py b/commitizen/commands/commit.py index a60a31e257..8b3bb136da 100644 --- a/commitizen/commands/commit.py +++ b/commitizen/commands/commit.py @@ -98,6 +98,7 @@ def __call__(self): ) if signoff: + out.warn("signoff mechanic is deprecated, please use `cz commit -- -s` instead.") c = git.commit(m, "-s") if self.arguments.get("extra_cli_args"): From 142094ec5721310db8c4537b6871842c7254bb7d Mon Sep 17 00:00:00 2001 From: SCrocky <> Date: Sun, 14 May 2023 12:37:01 +0800 Subject: [PATCH 3/8] test(cli.py): Added tests for -- argument notation raises --- tests/test_cli.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 6d53ed7ba2..4b1788a255 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -7,7 +7,9 @@ from pytest_mock import MockFixture from commitizen import cli -from commitizen.exceptions import ExpectedExit, NoCommandFoundError, NotAGitProjectError +from commitizen.exceptions import ( + ExpectedExit, NoCommandFoundError, NotAGitProjectError, InvalidCommandArgumentError, NothingToCommitError +) def test_sysexit_no_argv(mocker: MockFixture, capsys): @@ -149,3 +151,19 @@ def test_parse_no_raise_mix_invalid_arg_is_skipped(): input_str = "NO_COMMITIZEN_FOUND,2,nothing,4" result = cli.parse_no_raise(input_str) assert result == [1, 2, 4] + + +def test_unknown_args_raises(mocker: MockFixture): + testargs = ["cz", "c", "-this_arg_is_not_supported"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(InvalidCommandArgumentError) as excinfo: + cli.main() + assert "Invalid commitizen arguments were found" in str(excinfo.value) + + +def test_unknown_args_before_double_dash_raises(mocker: MockFixture): + testargs = ["cz", "c", "-this_arg_is_not_supported", "--"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(InvalidCommandArgumentError) as excinfo: + cli.main() + assert "Invalid commitizen arguments were found before -- separator" in str(excinfo.value) From 081332dc1b96ff3ca0eaeb2229091ba0d3897972 Mon Sep 17 00:00:00 2001 From: SCrocky <> Date: Sun, 14 May 2023 17:38:32 +0800 Subject: [PATCH 4/8] docs(docs/commit.md): Added documentation for `--` syntax to separate commitizen args from git commit cli args --- docs/commit.md | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/docs/commit.md b/docs/commit.md index ab6038946c..334c3062ac 100644 --- a/docs/commit.md +++ b/docs/commit.md @@ -4,28 +4,26 @@ In your terminal run `cz commit` or the shortcut `cz c` to generate a guided git commit. -A commit can be signed off using `cz commit --signoff` or the shortcut `cz commit -s`. - You can run `cz commit --write-message-to-file COMMIT_MSG_FILE` to additionally save the generated message to a file. This can be combined with the `--dry-run` flag to only write the message to a file and not modify files and create a commit. A possible use case for this is to [automatically prepare a commit message](./tutorials/auto_prepare_commit_message.md). -!!! note - To maintain platform compatibility, the `commit` command disables ANSI escaping in its output. - In particular, pre-commit hooks coloring will be deactivated as discussed in [commitizen-tools/commitizen#417](https://github.com/commitizen-tools/commitizen/issues/417). - -## Configuration - -### `always_signoff` -When set to `true`, each commit message created by `cz commit` will be signed off. +!!! note + To maintain platform compatibility, the `commit` command disable ANSI escaping in its output. + In particular pre-commit hooks coloring will be deactivated as discussed in [commitizen-tools/commitizen#417](https://github.com/commitizen-tools/commitizen/issues/417). -Defaults to: `false`. -In your `pyproject.toml` or `.cz.toml`: +### git options -```toml -[tool.commitizen] -always_signoff = true +`git` command options that are not implemented by commitizen can be use via the `--` syntax for the `commit` command. +The syntax separates commitizen arguments from `git commit` arguments by a double dash. This is the resulting syntax: +``` +cz commit -commitizen-args -- -git-cli-args ``` +For example, using the `-S` option on `git commit` to sign a commit is now commitizen compatible: `cz c -- -S` + +!!! note + Deprecation warning: A commit can be signed off using `cz commit --signoff` or the shortcut `cz commit -s`. + This syntax is now deprecated in favor of the new `cz commit -- -s` syntax. \ No newline at end of file From 0abb01e5ddb106afe07564a4d45c6253f720e242 Mon Sep 17 00:00:00 2001 From: SCrocky <> Date: Sat, 23 Sep 2023 14:37:14 +0800 Subject: [PATCH 5/8] refactor: Code Review - round 1 changes --- commitizen/cli.py | 5 +++++ commitizen/commands/commit.py | 9 ++++----- docs/commit.md | 6 ++++-- tests/test_cli.py | 1 + tests/test_command_commit.py | 22 ++++++++++++++++++++++ 5 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 tests/test_command_commit.py diff --git a/commitizen/cli.py b/commitizen/cli.py index de1d3ba8a8..efea439d41 100644 --- a/commitizen/cli.py +++ b/commitizen/cli.py @@ -465,6 +465,11 @@ def main(): raise InvalidCommandArgumentError( f"Invalid commitizen arguments were found before -- separator: `{' '.join(unknown_args[:pos])}`. " ) + # Log warning for -- without any extra args + elif len(unknown_args) == 1: + logger.warning( + "Incomplete commit command: received -- separator without any following git arguments" + ) extra_args = " ".join(unknown_args[1:]) arguments["extra_cli_args"] = extra_args diff --git a/commitizen/commands/commit.py b/commitizen/commands/commit.py index 8b3bb136da..3eec0a1798 100644 --- a/commitizen/commands/commit.py +++ b/commitizen/commands/commit.py @@ -99,12 +99,11 @@ def __call__(self): if signoff: out.warn("signoff mechanic is deprecated, please use `cz commit -- -s` instead.") - c = git.commit(m, "-s") - - if self.arguments.get("extra_cli_args"): - c = git.commit(m, extra_args=self.arguments.get("extra_cli_args")) + extra_args = "-s " + self.arguments.get("extra_cli_args") else: - c = git.commit(m) + extra_args = self.arguments.get("extra_cli_args") + + c = git.commit(m, extra_args=extra_args) if c.return_code != 0: out.error(c.err) diff --git a/docs/commit.md b/docs/commit.md index 334c3062ac..50eeea8c2c 100644 --- a/docs/commit.md +++ b/docs/commit.md @@ -19,8 +19,10 @@ case for this is to [automatically prepare a commit message](./tutorials/auto_pr `git` command options that are not implemented by commitizen can be use via the `--` syntax for the `commit` command. The syntax separates commitizen arguments from `git commit` arguments by a double dash. This is the resulting syntax: -``` -cz commit -commitizen-args -- -git-cli-args +```sh +cz commit -- + +# e.g., cz commit --dry-run -- -a -S ``` For example, using the `-S` option on `git commit` to sign a commit is now commitizen compatible: `cz c -- -S` diff --git a/tests/test_cli.py b/tests/test_cli.py index 4b1788a255..ed083bc10d 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -167,3 +167,4 @@ def test_unknown_args_before_double_dash_raises(mocker: MockFixture): with pytest.raises(InvalidCommandArgumentError) as excinfo: cli.main() assert "Invalid commitizen arguments were found before -- separator" in str(excinfo.value) + diff --git a/tests/test_command_commit.py b/tests/test_command_commit.py new file mode 100644 index 0000000000..59670f65d7 --- /dev/null +++ b/tests/test_command_commit.py @@ -0,0 +1,22 @@ +import sys + +from unittest.mock import patch +from pytest_mock import MockFixture + +from commitizen import cli +from commitizen.commands.commit import Commit + + +def test_extra_args_no_raise(mocker: MockFixture): + testargs = ["cz", "c", "--dry-run", "--", "-extra-args1", "-extra-arg2"] + extra_cli_args = "-extra-args1 -extra-args2" + mocker.patch.object(sys, "argv", testargs) + commit_call = mocker.patch.object(Commit, "__call__") + + def assert_extra_args(self): + assert self.arguments["extra_cli_args"] == extra_cli_args + + with patch.object(Commit, "test_extra_args", assert_extra_args, autospec=True) as mock: + commit_call.side_effect = Commit.test_extra_args + cli.main() + Commit.__call__.assert_called_once() From 8df5c9491934943e3125e93480ee1dda128b743d Mon Sep 17 00:00:00 2001 From: Scrocky <--global> Date: Sun, 24 Sep 2023 19:54:38 +0800 Subject: [PATCH 6/8] refactor(extra_args): Fixed broken code due to rebase and finalized tests --- commitizen/commands/commit.py | 8 +++++--- commitizen/git.py | 7 +++++-- docs/bump.md | 2 +- docs/commit.md | 2 +- tests/commands/test_commit_command.py | 26 +++++++++++++++++++++++--- tests/test_cli.py | 10 +++++++--- tests/test_command_commit.py | 22 ---------------------- 7 files changed, 42 insertions(+), 35 deletions(-) delete mode 100644 tests/test_command_commit.py diff --git a/commitizen/commands/commit.py b/commitizen/commands/commit.py index 3eec0a1798..5fde3ea6b8 100644 --- a/commitizen/commands/commit.py +++ b/commitizen/commands/commit.py @@ -98,10 +98,12 @@ def __call__(self): ) if signoff: - out.warn("signoff mechanic is deprecated, please use `cz commit -- -s` instead.") - extra_args = "-s " + self.arguments.get("extra_cli_args") + out.warn( + "signoff mechanic is deprecated, please use `cz commit -- -s` instead." + ) + extra_args = self.arguments.get("extra_cli_args", "--") + " -s" else: - extra_args = self.arguments.get("extra_cli_args") + extra_args = self.arguments.get("extra_cli_args", "") c = git.commit(m, extra_args=extra_args) diff --git a/commitizen/git.py b/commitizen/git.py index 2565ad8296..33f4e455b0 100644 --- a/commitizen/git.py +++ b/commitizen/git.py @@ -98,13 +98,16 @@ def add(args: str = "") -> cmd.Command: def commit( - message: str, args: str = "", extra_args: str = "", committer_date: str | None = None + message: str, + args: str = "", + extra_args: str = "", + committer_date: str | None = None, ) -> cmd.Command: f = NamedTemporaryFile("wb", delete=False) f.write(message.encode("utf-8")) f.close() - command = cmd.run(f"git commit {args} {extra_args} -F {f.name}") + command = f"git commit {args} {extra_args} -F {f.name}" if committer_date and os.name == "nt": # pragma: no cover # Using `cmd /v /c "{command}"` sets environment variables only for that command diff --git a/docs/bump.md b/docs/bump.md index 287d4e1e35..e58a11e18d 100644 --- a/docs/bump.md +++ b/docs/bump.md @@ -323,7 +323,7 @@ These are used in: * `cz bump`: Find previous release tag (exact match) and generate new tag. * Find previous release tags in `cz changelog`. - * If `--incremental`: Using latest version found in the changelog, scan existing Git tags with 89\% similarity match. + * If `--incremental`: Using latest version found in the changelog, scan existing Git tags with 89\% similarity match. * `--rev-range` is converted to Git tag names with `tag_format` before searching Git history. * If the `scm` `version_provider` is used, it uses different regexes to find the previous version tags: * If `tag_format` is set to `$version` (default): `VersionProtocol.parser` (allows `v` prefix) diff --git a/docs/commit.md b/docs/commit.md index 50eeea8c2c..2215e0d805 100644 --- a/docs/commit.md +++ b/docs/commit.md @@ -28,4 +28,4 @@ For example, using the `-S` option on `git commit` to sign a commit is now commi !!! note Deprecation warning: A commit can be signed off using `cz commit --signoff` or the shortcut `cz commit -s`. - This syntax is now deprecated in favor of the new `cz commit -- -s` syntax. \ No newline at end of file + This syntax is now deprecated in favor of the new `cz commit -- -s` syntax. diff --git a/tests/commands/test_commit_command.py b/tests/commands/test_commit_command.py index b48ac9d0ed..16489d9858 100644 --- a/tests/commands/test_commit_command.py +++ b/tests/commands/test_commit_command.py @@ -88,7 +88,7 @@ def test_commit_retry_works(config, mocker: MockFixture): commands.Commit(config, {"retry": True})() - commit_mock.assert_called_with("feat: user created\n\ncloses #21") + commit_mock.assert_called_with("feat: user created\n\ncloses #21", extra_args="") prompt_mock.assert_called_once() success_mock.assert_called_once() assert not os.path.isfile(temp_file) @@ -174,7 +174,7 @@ def test_commit_command_with_signoff_option(config, mocker: MockFixture): commands.Commit(config, {"signoff": True})() - commit_mock.assert_called_once_with(ANY, "-s") + commit_mock.assert_called_once_with(ANY, extra_args="-- -s") success_mock.assert_called_once() @@ -197,7 +197,7 @@ def test_commit_command_with_always_signoff_enabled(config, mocker: MockFixture) config.settings["always_signoff"] = True commands.Commit(config, {})() - commit_mock.assert_called_once_with(ANY, "-s") + commit_mock.assert_called_once_with(ANY, extra_args="-- -s") success_mock.assert_called_once() @@ -276,3 +276,23 @@ def test_commit_command_with_all_option(config, mocker: MockFixture): commands.Commit(config, {"all": True})() add_mock.assert_called() success_mock.assert_called_once() + + +@pytest.mark.usefixtures("staging_is_clean") +def test_commit_command_with_extra_args(config, mocker: MockFixture): + prompt_mock = mocker.patch("questionary.prompt") + prompt_mock.return_value = { + "prefix": "feat", + "subject": "user created", + "scope": "", + "is_breaking_change": False, + "body": "", + "footer": "", + } + + commit_mock = mocker.patch("commitizen.git.commit") + commit_mock.return_value = cmd.Command("success", "", b"", b"", 0) + success_mock = mocker.patch("commitizen.out.success") + commands.Commit(config, {"extra_cli_args": "-- -extra-args1 -extra-arg2"})() + commit_mock.assert_called_once_with(ANY, extra_args="-- -extra-args1 -extra-arg2") + success_mock.assert_called_once() diff --git a/tests/test_cli.py b/tests/test_cli.py index ed083bc10d..93f6c16ddd 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -8,7 +8,10 @@ from commitizen import cli from commitizen.exceptions import ( - ExpectedExit, NoCommandFoundError, NotAGitProjectError, InvalidCommandArgumentError, NothingToCommitError + ExpectedExit, + NoCommandFoundError, + NotAGitProjectError, + InvalidCommandArgumentError, ) @@ -166,5 +169,6 @@ def test_unknown_args_before_double_dash_raises(mocker: MockFixture): mocker.patch.object(sys, "argv", testargs) with pytest.raises(InvalidCommandArgumentError) as excinfo: cli.main() - assert "Invalid commitizen arguments were found before -- separator" in str(excinfo.value) - + assert "Invalid commitizen arguments were found before -- separator" in str( + excinfo.value + ) diff --git a/tests/test_command_commit.py b/tests/test_command_commit.py deleted file mode 100644 index 59670f65d7..0000000000 --- a/tests/test_command_commit.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys - -from unittest.mock import patch -from pytest_mock import MockFixture - -from commitizen import cli -from commitizen.commands.commit import Commit - - -def test_extra_args_no_raise(mocker: MockFixture): - testargs = ["cz", "c", "--dry-run", "--", "-extra-args1", "-extra-arg2"] - extra_cli_args = "-extra-args1 -extra-args2" - mocker.patch.object(sys, "argv", testargs) - commit_call = mocker.patch.object(Commit, "__call__") - - def assert_extra_args(self): - assert self.arguments["extra_cli_args"] == extra_cli_args - - with patch.object(Commit, "test_extra_args", assert_extra_args, autospec=True) as mock: - commit_call.side_effect = Commit.test_extra_args - cli.main() - Commit.__call__.assert_called_once() From 4baecd649857eec9541edd340448198d6d948185 Mon Sep 17 00:00:00 2001 From: Scrocky <--global> Date: Sun, 24 Sep 2023 22:42:23 +0800 Subject: [PATCH 7/8] style(extra_args): Added newlines and WARN to 'Incomplete commit command' warning --- commitizen/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commitizen/cli.py b/commitizen/cli.py index efea439d41..212c89b6f7 100644 --- a/commitizen/cli.py +++ b/commitizen/cli.py @@ -468,7 +468,7 @@ def main(): # Log warning for -- without any extra args elif len(unknown_args) == 1: logger.warning( - "Incomplete commit command: received -- separator without any following git arguments" + "\nWARN: Incomplete commit command: received -- separator without any following git arguments\n" ) extra_args = " ".join(unknown_args[1:]) arguments["extra_cli_args"] = extra_args From 5159a628ab7ce361d1f93f3394b8014612859a22 Mon Sep 17 00:00:00 2001 From: Scrocky <--global> Date: Tue, 3 Oct 2023 01:56:49 +0800 Subject: [PATCH 8/8] refactor(git.py): Removed 'extra_args' from git.commit --- commitizen/commands/commit.py | 2 +- commitizen/git.py | 3 +-- tests/commands/test_commit_command.py | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/commitizen/commands/commit.py b/commitizen/commands/commit.py index 5fde3ea6b8..adb630af86 100644 --- a/commitizen/commands/commit.py +++ b/commitizen/commands/commit.py @@ -105,7 +105,7 @@ def __call__(self): else: extra_args = self.arguments.get("extra_cli_args", "") - c = git.commit(m, extra_args=extra_args) + c = git.commit(m, args=extra_args) if c.return_code != 0: out.error(c.err) diff --git a/commitizen/git.py b/commitizen/git.py index 33f4e455b0..46aa3abffc 100644 --- a/commitizen/git.py +++ b/commitizen/git.py @@ -100,14 +100,13 @@ def add(args: str = "") -> cmd.Command: def commit( message: str, args: str = "", - extra_args: str = "", committer_date: str | None = None, ) -> cmd.Command: f = NamedTemporaryFile("wb", delete=False) f.write(message.encode("utf-8")) f.close() - command = f"git commit {args} {extra_args} -F {f.name}" + command = f"git commit {args} -F {f.name}" if committer_date and os.name == "nt": # pragma: no cover # Using `cmd /v /c "{command}"` sets environment variables only for that command diff --git a/tests/commands/test_commit_command.py b/tests/commands/test_commit_command.py index 16489d9858..e3f9989823 100644 --- a/tests/commands/test_commit_command.py +++ b/tests/commands/test_commit_command.py @@ -88,7 +88,7 @@ def test_commit_retry_works(config, mocker: MockFixture): commands.Commit(config, {"retry": True})() - commit_mock.assert_called_with("feat: user created\n\ncloses #21", extra_args="") + commit_mock.assert_called_with("feat: user created\n\ncloses #21", args="") prompt_mock.assert_called_once() success_mock.assert_called_once() assert not os.path.isfile(temp_file) @@ -174,7 +174,7 @@ def test_commit_command_with_signoff_option(config, mocker: MockFixture): commands.Commit(config, {"signoff": True})() - commit_mock.assert_called_once_with(ANY, extra_args="-- -s") + commit_mock.assert_called_once_with(ANY, args="-- -s") success_mock.assert_called_once() @@ -197,7 +197,7 @@ def test_commit_command_with_always_signoff_enabled(config, mocker: MockFixture) config.settings["always_signoff"] = True commands.Commit(config, {})() - commit_mock.assert_called_once_with(ANY, extra_args="-- -s") + commit_mock.assert_called_once_with(ANY, args="-- -s") success_mock.assert_called_once() @@ -294,5 +294,5 @@ def test_commit_command_with_extra_args(config, mocker: MockFixture): commit_mock.return_value = cmd.Command("success", "", b"", b"", 0) success_mock = mocker.patch("commitizen.out.success") commands.Commit(config, {"extra_cli_args": "-- -extra-args1 -extra-arg2"})() - commit_mock.assert_called_once_with(ANY, extra_args="-- -extra-args1 -extra-arg2") + commit_mock.assert_called_once_with(ANY, args="-- -extra-args1 -extra-arg2") success_mock.assert_called_once()