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