Skip to content

Commit 9576369

Browse files
authored
Merge pull request #62 from Woile/fix/failing-tests
fix(test_cli): testing the version command
2 parents aca827a + 94f37bc commit 9576369

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ classifiers = [
4545

4646
[tool.poetry.dependencies]
4747
python = "^3.6"
48-
questionary = "^1.4"
48+
questionary = "^1.4.0"
4949
decli = "^0.5.0"
5050
colorama = "^0.4.1"
5151
termcolor = "^1.1"

tests/test_cli.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ def test_ls(mocker, capsys):
2222

2323
def test_version(mocker):
2424
testargs = ["cz", "--version"]
25-
with pytest.raises(SystemExit):
26-
mocker.patch.object(sys, "argv", testargs)
27-
cli.main()
25+
mocker.patch.object(sys, "argv", testargs)
26+
error_mock = mocker.patch("commitizen.out.error")
27+
28+
cli.main()
29+
30+
error_mock.assert_called_once()

tests/test_commands.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def test_commit_when_nothing_to_commit(mocker):
9696
def test_commit_when_customized_expected_raised(mocker, capsys):
9797
_err = ValueError()
9898
_err.__context__ = CzException("This is the root custom err")
99-
99+
git_mock = mocker.patch("commitizen.git.is_staging_clean")
100+
git_mock.return_value = False
100101
prompt_mock = mocker.patch("questionary.prompt")
101102
prompt_mock.side_effect = _err
102103

0 commit comments

Comments
 (0)