Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usages of tempfile.mktemp (#3270) #3313

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/common/utils/test_file_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_append_file(self):
os.remove(test_file)

def test_findre_in_file(self):
fp = tempfile.mktemp()
fp = os.path.join(self.tmp_dir, "test_findre_in_file")
with open(fp, 'w') as f:
f.write(
'''
Expand All @@ -107,7 +107,7 @@ def test_findre_in_file(self):
fileutil.findre_in_file(fp, "^Do not match.*"))

def test_findstr_in_file(self):
fp = tempfile.mktemp()
fp = os.path.join(self.tmp_dir, "test_findstr_in_file")
with open(fp, 'w') as f:
f.write(
'''
Expand Down
4 changes: 1 addition & 3 deletions tests/pa/test_provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import os
import re
import tempfile
import unittest

import azurelinuxagent.common.conf as conf
Expand Down Expand Up @@ -55,8 +54,7 @@ def test_provision(self, mock_util, distro_name, distro_version, distro_full_nam

def test_customdata(self):
base64data = 'Q3VzdG9tRGF0YQ=='
data = DefaultOSUtil().decode_customdata(base64data)
fileutil.write_file(tempfile.mktemp(), data)
DefaultOSUtil().decode_customdata(base64data)

@patch('azurelinuxagent.common.conf.get_provision_enabled',
return_value=False)
Expand Down
Loading