Skip to content

Commit a0c895b

Browse files
committed
close files opened by mkstemp
1 parent 5602437 commit a0c895b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/test_cmd2.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ def test_save_invalid_path(base_app, capsys):
506506

507507
def test_output_redirection(base_app):
508508
fd, filename = tempfile.mkstemp(prefix='cmd2_test', suffix='.txt')
509+
os.close(fd)
509510

510511
try:
511512
# Verify that writing to a file works
@@ -530,7 +531,8 @@ def test_output_redirection(base_app):
530531
def test_feedback_to_output_true(base_app):
531532
base_app.feedback_to_output = True
532533
base_app.timing = True
533-
fd, filename = tempfile.mkstemp(prefix='cmd2_test', suffix='.txt')
534+
f, filename = tempfile.mkstemp(prefix='cmd2_test', suffix='.txt')
535+
os.close(f)
534536

535537
try:
536538
run_cmd(base_app, 'help > {}'.format(filename))
@@ -546,7 +548,8 @@ def test_feedback_to_output_true(base_app):
546548
def test_feedback_to_output_false(base_app, capsys):
547549
base_app.feedback_to_output = False
548550
base_app.timing = True
549-
fd, filename = tempfile.mkstemp(prefix='feedback_to_output', suffix='.txt')
551+
f, filename = tempfile.mkstemp(prefix='feedback_to_output', suffix='.txt')
552+
os.close(f)
550553

551554
try:
552555
run_cmd(base_app, 'help > {}'.format(filename))

0 commit comments

Comments
 (0)