mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
Merge pull request #21254 from BerriAI/fix/langfuse-test-counter-cleanup
fix(test): restore Langfuse client counter in test cleanup
This commit is contained in:
commit
0b66bbd904
1 changed files with 6 additions and 0 deletions
|
|
@ -21,6 +21,9 @@ from litellm.types.integrations.langfuse import *
|
|||
|
||||
class TestLangfuseUsageDetails(unittest.TestCase):
|
||||
def setUp(self):
|
||||
# Save global Langfuse client counter to restore after test
|
||||
self._original_langfuse_clients_count = litellm.initialized_langfuse_clients
|
||||
|
||||
# Set up environment variables for testing
|
||||
self.env_patcher = patch.dict(
|
||||
"os.environ",
|
||||
|
|
@ -130,6 +133,9 @@ class TestLangfuseUsageDetails(unittest.TestCase):
|
|||
# Delete logger instance to ensure complete cleanup
|
||||
del self.logger
|
||||
|
||||
# Restore global Langfuse client counter to prevent cross-test pollution
|
||||
litellm.initialized_langfuse_clients = self._original_langfuse_clients_count
|
||||
|
||||
self.env_patcher.stop()
|
||||
self.langfuse_module_patcher.stop() # patch.dict automatically restores sys.modules
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue