8
8
from commitizen import cli , cmd , git
9
9
from commitizen .exceptions import (
10
10
BumpTagFailedError ,
11
+ CommitizenException ,
11
12
CurrentVersionNotFoundError ,
12
13
DryRunExit ,
14
+ ExitCode ,
13
15
ExpectedExit ,
14
16
NoCommitsFoundError ,
15
17
NoneIncrementExit ,
@@ -327,7 +329,7 @@ def test_none_increment_exit_should_be_a_class():
327
329
328
330
329
331
def test_none_increment_exit_should_be_expected_exit_subclass ():
330
- assert issubclass (NoneIncrementExit , ExpectedExit )
332
+ assert issubclass (NoneIncrementExit , CommitizenException )
331
333
332
334
333
335
def test_none_increment_exit_should_exist_in_bump ():
@@ -339,7 +341,9 @@ def test_none_increment_exit_is_exception():
339
341
340
342
341
343
@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
+ ):
343
347
create_file_and_commit ("test(test_get_all_droplets): fix bad comparison test" )
344
348
testargs = ["cz" , "bump" , "--yes" ]
345
349
mocker .patch .object (sys , "argv" , testargs )
@@ -350,8 +354,12 @@ def test_none_increment_should_not_call_git_tag(mocker, tmp_commitizen_project):
350
354
git .tag = MagicMock (return_value = dummy_value )
351
355
352
356
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
355
363
356
364
# restore pop stashed
357
365
git .tag = stashed_git_tag
0 commit comments