@@ -365,6 +365,15 @@ def test_changelog_without_revision(mocker, tmp_commitizen_project):
365
365
cli .main ()
366
366
367
367
368
+ def test_changelog_incremental_with_revision (mocker ):
369
+ """combining incremental with a revision doesn't make sense"""
370
+ testargs = ["cz" , "changelog" , "--incremental" , "0.2.0" ]
371
+ mocker .patch .object (sys , "argv" , testargs )
372
+
373
+ with pytest .raises (NotAllowed ):
374
+ cli .main ()
375
+
376
+
368
377
def test_changelog_with_different_tag_name_and_changelog_content (
369
378
mocker , tmp_commitizen_project
370
379
):
@@ -895,3 +904,15 @@ def test_invalid_subject_is_skipped(mocker, capsys):
895
904
out , _ = capsys .readouterr ()
896
905
897
906
assert out == ("## Unreleased\n \n ### Feat\n \n - a new world\n \n " )
907
+
908
+
909
+ @pytest .mark .usefixtures ("tmp_commitizen_project" )
910
+ def test_empty_commit_list (mocker ):
911
+ create_file_and_commit ("feat: a new world" )
912
+
913
+ # test changelog properly handles when no commits are found for the revision
914
+ mocker .patch ("commitizen.git.get_commits" , return_value = [])
915
+ testargs = ["cz" , "changelog" ]
916
+ mocker .patch .object (sys , "argv" , testargs )
917
+ with pytest .raises (NoCommitsFoundError ):
918
+ cli .main ()
0 commit comments