Skip to content

Commit 373ec25

Browse files
committed
test(commands/commit): set staging to clean for most commit tests
1 parent da131a4 commit 373ec25

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_commands.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
config = {"name": defaults.name}
99

1010

11+
@pytest.fixture
12+
def staging_is_clean(mocker):
13+
is_staging_clean_mock = mocker.patch("commitizen.git.is_staging_clean")
14+
is_staging_clean_mock.return_value = False
15+
16+
17+
@pytest.mark.usefixtures("staging_is_clean")
1118
def test_commit(mocker):
1219
prompt_mock = mocker.patch("questionary.prompt")
1320
prompt_mock.return_value = {
@@ -27,6 +34,7 @@ def test_commit(mocker):
2734
success_mock.assert_called_once()
2835

2936

37+
@pytest.mark.usefixtures("staging_is_clean")
3038
def test_commit_retry_fails_no_backup(mocker):
3139
commit_mock = mocker.patch("commitizen.git.commit")
3240
commit_mock.return_value = cmd.Command("success", "", "", "")
@@ -35,6 +43,7 @@ def test_commit_retry_fails_no_backup(mocker):
3543
commands.Commit(config, {"retry": True})()
3644

3745

46+
@pytest.mark.usefixtures("staging_is_clean")
3847
def test_commit_retry_works(mocker):
3948
prompt_mock = mocker.patch("questionary.prompt")
4049
prompt_mock.return_value = {

0 commit comments

Comments
 (0)