Update CLI to use autotemp for tempfiles
Signed-off-by: Scott Zawalski <scottz@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3396 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/cli/cli_mock.py b/cli/cli_mock.py
index 27b16ac..e6499e9 100755
--- a/cli/cli_mock.py
+++ b/cli/cli_mock.py
@@ -3,21 +3,22 @@
"""Test for cli."""
-import unittest, os, sys, tempfile, StringIO
+import unittest, os, sys, StringIO
import common
from autotest_lib.cli import atest, topic_common, rpc
from autotest_lib.frontend.afe.json_rpc import proxy
from autotest_lib.client.common_lib.test_utils import mock
+from autotest_lib.client.common_lib import autotemp
CLI_USING_PDB = False
CLI_UT_DEBUG = False
def create_file(content):
- (fp, filename) = tempfile.mkstemp(text=True)
- os.write(fp, content)
- os.close(fp)
- return filename
+ file_temp = autotemp.tempfile(unique_id='cli_mock', text=True)
+ os.write(file_temp.fd, content)
+ os.close(file_temp.fd)
+ return file_temp
class ExitException(Exception):