Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2a8a8ea

Browse files
oed-gubinaLee-W
authored andcommitted
fix(commit): use os.unlink to remove temp file
NamedTemporaryFile doesn't have a unlink function when delete=False is used Fix #1352
1 parent af28565 commit 2a8a8ea

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

‎commitizen/commands/commit.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def manual_edit(self, message: str) -> str:
8989
subprocess.call(argv)
9090
with open(file_path) as temp_file:
9191
message = temp_file.read().strip()
92-
file.unlink()
92+
os.unlink(file.name)
9393
return message
9494

9595
def __call__(self):

‎tests/commands/test_commit_command.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,6 @@ def test_manual_edit(editor, config, mocker: MockFixture, tmp_path):
511511

512512
assert edited_message == test_message.strip()
513513

514-
temp_file.unlink()
515-
516514

517515
@skip_below_py_3_13
518516
def test_commit_command_shows_description_when_use_help_option(

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /