summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJared Crapo <jared@kotfu.net>2017-08-19 14:26:17 -0600
committerJared Crapo <jared@kotfu.net>2017-08-19 14:26:17 -0600
commita0c895b3b773dfaca3667da0db794457d0b93b03 (patch)
treea9d672bf19d64dc87c0f89eb827d009e00fce1d5 /tests
parent5602437e7a19b2be1133bd3290f823b222232ad3 (diff)
downloadcmd2-git-a0c895b3b773dfaca3667da0db794457d0b93b03.tar.gz
close files opened by mkstemp
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cmd2.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 4f8e1647..67dfacf4 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -506,6 +506,7 @@ def test_save_invalid_path(base_app, capsys):
def test_output_redirection(base_app):
fd, filename = tempfile.mkstemp(prefix='cmd2_test', suffix='.txt')
+ os.close(fd)
try:
# Verify that writing to a file works
@@ -530,7 +531,8 @@ def test_output_redirection(base_app):
def test_feedback_to_output_true(base_app):
base_app.feedback_to_output = True
base_app.timing = True
- fd, filename = tempfile.mkstemp(prefix='cmd2_test', suffix='.txt')
+ f, filename = tempfile.mkstemp(prefix='cmd2_test', suffix='.txt')
+ os.close(f)
try:
run_cmd(base_app, 'help > {}'.format(filename))
@@ -546,7 +548,8 @@ def test_feedback_to_output_true(base_app):
def test_feedback_to_output_false(base_app, capsys):
base_app.feedback_to_output = False
base_app.timing = True
- fd, filename = tempfile.mkstemp(prefix='feedback_to_output', suffix='.txt')
+ f, filename = tempfile.mkstemp(prefix='feedback_to_output', suffix='.txt')
+ os.close(f)
try:
run_cmd(base_app, 'help > {}'.format(filename))