Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5318325

Browse files
committed
test(changelog): fixes logic issue made evident by latest fix(git) commit
Exception is raised by git error: "fatal: your current branch 'master' does not have any commits yet". This response is more informative than the original "No commits found" exception and the "fail fast" logic is a bit easier to follow.
1 parent 9b243a3 commit 5318325

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎tests/commands/test_changelog_command.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from commitizen.commands.changelog import Changelog
77
from commitizen.exceptions import (
88
DryRunExit,
9+
GitCommandError,
910
NoCommitsFoundError,
1011
NoRevisionError,
1112
NotAGitProjectError,
@@ -19,10 +20,12 @@ def test_changelog_on_empty_project(mocker):
1920
testargs = ["cz", "changelog", "--dry-run"]
2021
mocker.patch.object(sys, "argv", testargs)
2122

22-
with pytest.raises(NoCommitsFoundError) asexcinfo:
23+
with pytest.raises(GitCommandError):
2324
cli.main()
2425

25-
assert "No commits found" in str(excinfo)
26+
# git will error out with something like:
27+
# "your current branch 'XYZ' does not have any commits yet"
28+
# is it wise to assert the exception contains a message like this?
2629

2730

2831
@pytest.mark.usefixtures("tmp_commitizen_project")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /