Skip to content
Open
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
15 changes: 15 additions & 0 deletions packages/client/tests/test_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ def reset_singleton() -> None:
reset_ai_sdk_info(clear_known=True)


@pytest.fixture(autouse=True)
def clear_endpoint_env(monkeypatch: pytest.MonkeyPatch) -> None:
"""
``init_client`` passes ``LD_BASE_URI``, ``LD_STREAM_URI`` and
``LD_EVENTS_URI`` to ``Config``, so tests asserting the exact ``Config``
call fail when any is set. A developer shell can set them, and so can a
``.env`` file: importing ``litellm`` during collection runs
``load_dotenv()``, which searches upward from litellm's own install
directory, so a ``.venv`` inside a checkout finds that checkout's
``.env``. All three are cleared around each test, and restored after.
"""
for name in ("LD_BASE_URI", "LD_STREAM_URI", "LD_EVENTS_URI"):
monkeypatch.delenv(name, raising=False)


@pytest.fixture
def restore_otel_globals() -> Any:
"""Snapshot and restore the real OTel trace globals around one test.
Expand Down
Loading