File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,9 @@ def prompt_commit_questions(self) -> str:
51
51
return cz .message (answers )
52
52
53
53
def __call__ (self ):
54
- if git .is_staging_clean ():
54
+ dry_run : bool = self .arguments .get ("dry_run" )
55
+
56
+ if git .is_staging_clean () and not dry_run :
55
57
out .write ("No files added to staging!" )
56
58
raise SystemExit (NOTHING_TO_COMMIT )
57
59
@@ -64,8 +66,6 @@ def __call__(self):
64
66
65
67
out .info (f"\n { m } \n " )
66
68
67
- dry_run : bool = self .arguments .get ("dry_run" )
68
-
69
69
if dry_run :
70
70
raise SystemExit (NOTHING_TO_COMMIT )
71
71
Original file line number Diff line number Diff line change @@ -110,11 +110,10 @@ def test_commit_when_nothing_to_commit(mocker):
110
110
assert err .value .code == commands .commit .NOTHING_TO_COMMIT
111
111
112
112
113
+ @pytest .mark .usefixtures ("staging_is_clean" )
113
114
def test_commit_when_customized_expected_raised (mocker , capsys ):
114
115
_err = ValueError ()
115
116
_err .__context__ = CzException ("This is the root custom err" )
116
- git_mock = mocker .patch ("commitizen.git.is_staging_clean" )
117
- git_mock .return_value = False
118
117
prompt_mock = mocker .patch ("questionary.prompt" )
119
118
prompt_mock .side_effect = _err
120
119
You can’t perform that action at this time.
0 commit comments