mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
test(otel v2): clear the cached LITELLM_OTEL_V2 flag after each destination test so it stops leaking into later modules
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
75f926da36
commit
1ccbc51ed8
1 changed files with 9 additions and 0 deletions
|
|
@ -82,6 +82,15 @@ def isolate_published_provider(monkeypatch):
|
|||
monkeypatch.setattr(otel_logger, "_published_v2_provider", None)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def forget_otel_v2_flag_after_each_test():
|
||||
"""``is_otel_v2_enabled`` caches its first answer. Tests here flip ``LITELLM_OTEL_V2``
|
||||
through monkeypatch, which restores the env but not the cache, so the next module
|
||||
on the worker would keep seeing v2 on."""
|
||||
yield
|
||||
is_otel_v2_enabled.cache_clear()
|
||||
|
||||
|
||||
def in_fresh_context(fn, *args):
|
||||
"""Run ``fn`` in its own context so one test's destinations never leak."""
|
||||
return contextvars.copy_context().run(fn, *args)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue