Skip to content

Commit 3bb6cbd

Browse files
BogayLee-W
authored andcommitted
test: fix some incompatible types of function calls
1 parent ffd0989 commit 3bb6cbd

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

commitizen/commands/check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import re
33
import sys
4-
from typing import Dict, Optional
4+
from typing import Any, Dict, Optional
55

66
from commitizen import factory, git, out
77
from commitizen.config import BaseConfig
@@ -15,7 +15,7 @@
1515
class Check:
1616
"""Check if the current commit msg matches the commitizen format."""
1717

18-
def __init__(self, config: BaseConfig, arguments: Dict[str, str], cwd=os.getcwd()):
18+
def __init__(self, config: BaseConfig, arguments: Dict[str, Any], cwd=os.getcwd()):
1919
"""Initial check command.
2020
2121
Args:

tests/commands/test_commit_command.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_commit(config, mocker: MockFixture):
3535
}
3636

3737
commit_mock = mocker.patch("commitizen.git.commit")
38-
commit_mock.return_value = cmd.Command("success", "", "", "", 0)
38+
commit_mock.return_value = cmd.Command("success", "", b"", b"", 0)
3939
success_mock = mocker.patch("commitizen.out.success")
4040

4141
commands.Commit(config, {})()
@@ -45,7 +45,7 @@ def test_commit(config, mocker: MockFixture):
4545
@pytest.mark.usefixtures("staging_is_clean")
4646
def test_commit_retry_fails_no_backup(config, mocker: MockFixture):
4747
commit_mock = mocker.patch("commitizen.git.commit")
48-
commit_mock.return_value = cmd.Command("success", "", "", "", 0)
48+
commit_mock.return_value = cmd.Command("success", "", b"", b"", 0)
4949

5050
with pytest.raises(NoCommitBackupError) as excinfo:
5151
commands.Commit(config, {"retry": True})()
@@ -66,7 +66,7 @@ def test_commit_retry_works(config, mocker: MockFixture):
6666
}
6767

6868
commit_mock = mocker.patch("commitizen.git.commit")
69-
commit_mock.return_value = cmd.Command("", "error", "", "", 9)
69+
commit_mock.return_value = cmd.Command("", "error", b"", b"", 9)
7070
error_mock = mocker.patch("commitizen.out.error")
7171

7272
with pytest.raises(CommitError):
@@ -80,7 +80,7 @@ def test_commit_retry_works(config, mocker: MockFixture):
8080

8181
# Previous commit failed, so retry should pick up the backup commit
8282
# commit_mock = mocker.patch("commitizen.git.commit")
83-
commit_mock.return_value = cmd.Command("success", "", "", "", 0)
83+
commit_mock.return_value = cmd.Command("success", "", b"", b"", 0)
8484
success_mock = mocker.patch("commitizen.out.success")
8585

8686
commands.Commit(config, {"retry": True})()
@@ -121,7 +121,7 @@ def test_commit_command_with_signoff_option(config, mocker: MockFixture):
121121
}
122122

123123
commit_mock = mocker.patch("commitizen.git.commit")
124-
commit_mock.return_value = cmd.Command("success", "", "", "", 0)
124+
commit_mock.return_value = cmd.Command("success", "", b"", b"", 0)
125125
success_mock = mocker.patch("commitizen.out.success")
126126

127127
commands.Commit(config, {"signoff": True})()

tests/test_cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import subprocess
33
import sys
4+
from functools import partial
45

56
import pytest
67
from pytest_mock import MockFixture
@@ -61,7 +62,9 @@ def test_arg_debug(mocker: MockFixture):
6162
testargs = ["cz", "--debug", "info"]
6263
mocker.patch.object(sys, "argv", testargs)
6364
cli.main()
64-
assert sys.excepthook.keywords.get("debug") is True
65+
excepthook = sys.excepthook
66+
assert isinstance(excepthook, partial)
67+
assert excepthook.keywords.get("debug") is True
6568

6669

6770
def test_commitizen_excepthook(capsys):

0 commit comments

Comments
 (0)