mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
test: skip symlink tests on Windows where symlink creation needs elevation
os.symlink and Path.symlink_to raise OSError WinError 1314 on Windows unless the process is elevated or Developer Mode is on, so three tests that build a symlink in tmp_path fail on a stock Windows box while the code under test is fine. Guard them with the same skipif(win32) marker already used for other platform-specific tests. Part 1 of the fix for #40046, covering only the symlink-privilege tests.
This commit is contained in:
parent
9b74e6f34e
commit
d7a17568c9
2 changed files with 5 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import json
|
||||
import shlex
|
||||
import stat
|
||||
import sys
|
||||
import time
|
||||
from unittest.mock import patch
|
||||
|
||||
|
|
@ -328,6 +329,7 @@ class TestConflictingOwnersOfTheSettingsFile:
|
|||
|
||||
|
||||
class TestDoesNotDestroyUserOwnedStructure:
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="symlink creation needs elevation or Developer Mode on Windows")
|
||||
def test_writes_through_a_symlinked_settings_file(self, tmp_path, lite_on_path):
|
||||
"""os.replace() swaps the symlink for a regular file, detaching a dotfiles repo.
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ arbitrary local image paths working while refusing non-image files like
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -52,6 +53,7 @@ class TestResolveValidatedLocalImagePath:
|
|||
result = resolve_validated_local_image_path("/proc/self/environ")
|
||||
assert result is None
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="symlink creation needs elevation or Developer Mode on Windows")
|
||||
def test_rejects_symlink_pointing_to_non_image(self, tmp_path):
|
||||
secret = tmp_path / "secret.txt"
|
||||
secret.write_text("password=hunter2")
|
||||
|
|
@ -62,6 +64,7 @@ class TestResolveValidatedLocalImagePath:
|
|||
|
||||
assert result is None
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="symlink creation needs elevation or Developer Mode on Windows")
|
||||
def test_accepts_symlink_pointing_to_image(self, tmp_path):
|
||||
logo = tmp_path / "real_logo.png"
|
||||
logo.write_bytes(b"\x89PNG\r\n\x1a\nfake png body")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue