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

fix: Replaced deprecated mktemp() function #32123

Merged
merged 1 commit into from
Jul 22, 2024
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
6 changes: 3 additions & 3 deletions tests/utils/test_image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def test_load_img_local(self):

def test_load_img_base64_prefix(self):
try:
tmp_file = tempfile.mktemp()
tmp_file = tempfile.NamedTemporaryFile(delete=False).name
with open(tmp_file, "wb") as f:
http_get(
"https://huggingface.co/datasets/hf-internal-testing/dummy-base64-images/raw/main/image_0.txt", f
Expand All @@ -530,7 +530,7 @@ def test_load_img_base64_prefix(self):

def test_load_img_base64(self):
try:
tmp_file = tempfile.mktemp()
tmp_file = tempfile.NamedTemporaryFile(delete=False).name
with open(tmp_file, "wb") as f:
http_get(
"https://huggingface.co/datasets/hf-internal-testing/dummy-base64-images/raw/main/image_1.txt", f
Expand All @@ -547,7 +547,7 @@ def test_load_img_base64(self):

def test_load_img_base64_encoded_bytes(self):
try:
tmp_file = tempfile.mktemp()
tmp_file = tempfile.NamedTemporaryFile(delete=False).name
with open(tmp_file, "wb") as f:
http_get(
"https://huggingface.co/datasets/hf-internal-testing/dummy-base64-images/raw/main/image_2.txt", f
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_tokenization_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_cached_files_are_used_when_internet_is_down_missing_files(self):
def test_legacy_load_from_one_file(self):
# This test is for deprecated behavior and can be removed in v5
try:
tmp_file = tempfile.mktemp()
tmp_file = tempfile.NamedTemporaryFile(delete=False).name
with open(tmp_file, "wb") as f:
http_get("https://huggingface.co/albert/albert-base-v1/resolve/main/spiece.model", f)

Expand Down