88from commitizen import cli , cmd , git
99from commitizen .exceptions import (
1010 BumpTagFailedError ,
11+ CommitizenException ,
1112 CurrentVersionNotFoundError ,
1213 DryRunExit ,
14+ ExitCode ,
1315 ExpectedExit ,
1416 NoCommitsFoundError ,
1517 NoneIncrementExit ,
@@ -327,7 +329,7 @@ def test_none_increment_exit_should_be_a_class():
327329
328330
329331def test_none_increment_exit_should_be_expected_exit_subclass ():
330- assert issubclass (NoneIncrementExit , ExpectedExit )
332+ assert issubclass (NoneIncrementExit , CommitizenException )
331333
332334
333335def test_none_increment_exit_should_exist_in_bump ():
@@ -339,7 +341,9 @@ def test_none_increment_exit_is_exception():
339341
340342
341343@pytest .mark .usefixtures ("tmp_commitizen_project" )
342- def test_none_increment_should_not_call_git_tag (mocker , tmp_commitizen_project ):
344+ def test_none_increment_should_not_call_git_tag_and_error_code_is_not_zero (
345+ mocker , tmp_commitizen_project
346+ ):
343347 create_file_and_commit ("test(test_get_all_droplets): fix bad comparison test" )
344348 testargs = ["cz" , "bump" , "--yes" ]
345349 mocker .patch .object (sys , "argv" , testargs )
@@ -350,8 +354,12 @@ def test_none_increment_should_not_call_git_tag(mocker, tmp_commitizen_project):
350354 git .tag = MagicMock (return_value = dummy_value )
351355
352356 with pytest .raises (NoneIncrementExit ):
353- cli .main ()
354- git .tag .assert_not_called ()
357+ try :
358+ cli .main ()
359+ except NoneIncrementExit as e :
360+ git .tag .assert_not_called ()
361+ assert e .exit_code == ExitCode .NO_COMMITS_FOUND
362+ raise e
355363
356364 # restore pop stashed
357365 git .tag = stashed_git_tag
0 commit comments