Files
litellm/tests/test_litellm/integrations
Julio Quinteros Pro 679a0293bd fix(test): restore Langfuse client counter in test cleanup
Fixes persistent test isolation issue in TestLangfuseUsageDetails by
saving and restoring the global litellm.initialized_langfuse_clients
counter.

Changes:
- Save litellm.initialized_langfuse_clients in setUp
- Restore original value in tearDown
- Prevents counter accumulation across tests

Root Cause:
PR #21248 added logger cleanup but missed the global client counter.
Each test increments litellm.initialized_langfuse_clients when creating
a LangFuseLogger, but the counter was never reset. This caused state
accumulation that could affect test behavior when tests run in certain
orders, leading to "Expected 'generation' to have been called once.
Called 0 times" failures.

Impact:
- test_log_langfuse_v2_handles_null_usage_values was still flaky
- Counter would accumulate: 1, 2, 3... across all tests
- While unlikely to hit MAX (50), accumulated state affected behavior

This completes the test isolation fix started in PR #21248.

Related: #21248
Fixes: Remaining test isolation issues in Langfuse tests

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:11:24 -03:00
..
2026-01-09 11:23:47 +09:00
2026-01-09 11:23:47 +09:00
2026-01-07 21:03:22 +05:30
2026-01-07 18:17:22 +05:30