mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-15 09:12:18 +00:00
fix(proxy): namespace debug environment variables
This commit is contained in:
parent
e0ed0a4c7a
commit
708d32ad04
2 changed files with 25 additions and 2 deletions
|
|
@ -698,7 +698,7 @@ class ProxyInitializationHelpers:
|
|||
is_flag=True,
|
||||
type=bool,
|
||||
help="To debug the input",
|
||||
envvar="DEBUG",
|
||||
envvar="LITELLM_DEBUG",
|
||||
)
|
||||
@click.option(
|
||||
"--detailed_debug",
|
||||
|
|
@ -706,7 +706,7 @@ class ProxyInitializationHelpers:
|
|||
is_flag=True,
|
||||
type=bool,
|
||||
help="To view detailed debug logs",
|
||||
envvar="DETAILED_DEBUG",
|
||||
envvar="LITELLM_DETAILED_DEBUG",
|
||||
)
|
||||
@click.option(
|
||||
"--use_queue",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import inspect
|
||||
import os
|
||||
from collections.abc import Mapping
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
|
@ -19,6 +20,28 @@ import yaml
|
|||
from litellm.proxy.proxy_cli import ProxyInitializationHelpers, run_server
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("environment", "arguments", "expected_debug", "expected_detailed_debug"),
|
||||
(
|
||||
({"DEBUG": "release"}, (), False, False),
|
||||
({"LITELLM_DEBUG": "1"}, (), True, False),
|
||||
({"DETAILED_DEBUG": "release"}, (), False, False),
|
||||
({"LITELLM_DETAILED_DEBUG": "1"}, (), False, True),
|
||||
({}, ("--debug", "--detailed_debug"), True, True),
|
||||
),
|
||||
)
|
||||
def test_debug_options_use_namespaced_environment_variables(
|
||||
environment: Mapping[str, str],
|
||||
arguments: tuple[str, ...],
|
||||
expected_debug: bool,
|
||||
expected_detailed_debug: bool,
|
||||
) -> None:
|
||||
with patch.dict(os.environ, environment, clear=True):
|
||||
with run_server.make_context("litellm", list(arguments)) as context:
|
||||
assert context.params["debug"] is expected_debug
|
||||
assert context.params["detailed_debug"] is expected_detailed_debug
|
||||
|
||||
|
||||
@pytest.mark.xdist_group("proxy_cli")
|
||||
class TestProxyInitializationHelpers:
|
||||
@patch("importlib.metadata.version")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue