mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-22 00:31:44 +00:00
fix(tests): remove misleading env vars from langfuse None-guard tests
The env vars in the regression tests had no effect — the functions under test operate only on the params dict and don't read from env vars. Clean up the test setup to avoid misleading future maintainers. Greptile feedback: P2
This commit is contained in:
parent
e1d234e170
commit
036c3cd2c5
1 changed files with 5 additions and 13 deletions
|
|
@ -129,34 +129,26 @@ def test_langfuse_handler_accepts_secret_key_alias(monkeypatch):
|
|||
assert captured["cached_logging_obj"] is logger
|
||||
|
||||
|
||||
def test_dynamic_langfuse_credentials_are_passed_handles_none(monkeypatch):
|
||||
def test_dynamic_langfuse_credentials_are_passed_handles_none():
|
||||
"""Regression test: _dynamic_langfuse_credentials_are_passed must not crash when standard_callback_dynamic_params is None.
|
||||
|
||||
When Langfuse is configured via environment variables (no per-request dynamic params),
|
||||
standard_callback_dynamic_params is None, not {}. The function must not raise
|
||||
AttributeError: 'NoneType' object has no attribute 'get'.
|
||||
"""
|
||||
monkeypatch.setenv("LANGFUSE_PUBLIC_KEY", "pk-test")
|
||||
monkeypatch.setenv("LANGFUSE_SECRET_KEY", "sk-test")
|
||||
monkeypatch.setenv("LANGFUSE_HOST", "https://langfuse.example")
|
||||
|
||||
# Should return False (no dynamic params passed), not raise AttributeError
|
||||
result = LangFuseHandler._dynamic_langfuse_credentials_are_passed(None)
|
||||
assert result is False
|
||||
|
||||
|
||||
def test_get_dynamic_langfuse_logging_config_handles_none(monkeypatch):
|
||||
def test_get_dynamic_langfuse_logging_config_handles_none():
|
||||
"""Regression test: get_dynamic_langfuse_logging_config must not crash when standard_callback_dynamic_params is None.
|
||||
|
||||
When Langfuse is configured via environment variables, standard_callback_dynamic_params is None.
|
||||
The function should return a config with None values (relying on env var fallback downstream).
|
||||
"""
|
||||
monkeypatch.setenv("LANGFUSE_PUBLIC_KEY", "pk-test")
|
||||
monkeypatch.setenv("LANGFUSE_SECRET_KEY", "sk-test")
|
||||
monkeypatch.setenv("LANGFUSE_HOST", "https://langfuse.example")
|
||||
|
||||
# Should not raise AttributeError
|
||||
config = LangFuseHandler.get_dynamic_langfuse_logging_config(None)
|
||||
assert config["langfuse_public_key"] is None
|
||||
assert config["langfuse_secret"] is None
|
||||
assert config["langfuse_host"] is None
|
||||
assert config.langfuse_public_key is None
|
||||
assert config.langfuse_secret is None
|
||||
assert config.langfuse_host is None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue