litellm/tests/integration/configuration/test_unit_conftest_isolation.py
devin-ai-integration[bot] a7a3a6b375
test: migrate legacy unit dirs and unrun folders into tests/unit, tests/integration and tests/e2e (#45940)
* test: migrate legacy unit dirs and unrun folders into tests/unit, tests/integration and tests/e2e

* test: fix disk cache collection, ungate saturation check, drop RSS memory tests

* test: assert one delivered log per completion in Datadog and LangSmith checks

* test: drop SDK-direct e2e copies and align cost-map path filter cases

---------

Co-authored-by: yuneng <yuneng@berri.ai>
2026-10-11 06:24:57 -07:00

43 lines
1.2 KiB
Python

import os
import subprocess
import sys
from pathlib import Path
from typing import Final
REPO_ROOT: Final = Path(__file__).resolve().parents[3]
PROXY_BASE_URL_SENSITIVE_NODE: Final = (
"tests/unit/proxy/management_endpoints/test_mcp_management_endpoints.py"
"::TestTemporaryMCPSessionEndpoints"
"::test_mcp_token_opens_sealed_passthrough_code_and_exchanges_with_minted_client"
)
COVERAGE_SUBPROCESS_VARS: Final = frozenset(
{"COV_CORE_SOURCE", "COV_CORE_CONFIG", "COV_CORE_DATAFILE", "COV_CORE_CONTEXT", "COVERAGE_PROCESS_START"}
)
def test_host_proxy_base_url_cannot_reach_request_derived_url_tests():
child_env: Final = {
key: value for key, value in os.environ.items() if key not in COVERAGE_SUBPROCESS_VARS
} | {"PROXY_BASE_URL": "https://leaked-host-origin.example.com"}
completed: Final = subprocess.run(
[
sys.executable,
"-m",
"pytest",
PROXY_BASE_URL_SENSITIVE_NODE,
"-q",
"--no-header",
"-p",
"no:cacheprovider",
],
cwd=REPO_ROOT,
env=child_env,
capture_output=True,
text=True,
check=False,
)
assert completed.returncode == 0, completed.stdout + completed.stderr