Skip to content

Commit ab42fd4

Browse files
committed
test(commit): pass path for write_message_to_file
1 parent ea3ecce commit ab42fd4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

‎tests/commands/test_commit_command.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,15 @@ def test_commit_command_with_write_message_to_file_option(
130130
commit_mock.return_value = cmd.Command("success", "", b"", b"", 0)
131131
success_mock = mocker.patch("commitizen.out.success")
132132

133-
commands.Commit(config, {"write_message_to_file": str(tmp_file)})()
133+
commands.Commit(config, {"write_message_to_file": tmp_file})()
134134
success_mock.assert_called_once()
135135
assert tmp_file.exists()
136136
assert tmp_file.read_text() == "feat: user created"
137137

138138

139139
@pytest.mark.usefixtures("staging_is_clean")
140-
@pytest.mark.parametrize("message_file", [True, False, 0, 1])
141140
def test_commit_command_with_invalid_write_message_to_file_option(
142-
config, message_file, mocker: MockFixture
141+
config, tmp_path, mocker: MockFixture
143142
):
144143
prompt_mock = mocker.patch("questionary.prompt")
145144
prompt_mock.return_value = {
@@ -152,8 +151,7 @@ def test_commit_command_with_invalid_write_message_to_file_option(
152151
}
153152

154153
with pytest.raises(NotAllowed):
155-
print(isinstance(message_file, str))
156-
commit_cmd = commands.Commit(config, {"write_message_to_file": message_file})
154+
commit_cmd = commands.Commit(config, {"write_message_to_file": tmp_path})
157155
commit_cmd()
158156

159157

0 commit comments

Comments
 (0)