Files
litellm/tests/test_litellm/integrations/arize/test_arize_phoenix.py
T
Krish Dholakia ef42461c1e Litellm fix GitHub action testing (#11163)
* test: add __init__.py files

* refactor: rename test folder to avoid naming conflict

* test: update workflows

* test: update tests

* test: update imports

* test: update tests

* test: remove unused import

* ci(test-litellm.yml): add pytest retry to github workflow

* test: fix test
2025-05-26 14:41:42 -07:00

47 lines
1.4 KiB
Python

import unittest
from unittest.mock import patch
from litellm.integrations.arize.arize_phoenix import ArizePhoenixLogger
class TestArizePhoenixConfig(unittest.TestCase):
@patch.dict(
"os.environ",
{
"PHOENIX_API_KEY": "test_api_key",
"PHOENIX_COLLECTOR_HTTP_ENDPOINT": "http://test.endpoint",
},
)
def test_get_arize_phoenix_config_http(self):
# Call the function to get the configuration
config = ArizePhoenixLogger.get_arize_phoenix_config()
# Verify the configuration
self.assertEqual(
config.otlp_auth_headers, "Authorization=Bearer%20test_api_key"
)
self.assertEqual(config.endpoint, "http://test.endpoint")
self.assertEqual(config.protocol, "otlp_http")
@patch.dict(
"os.environ",
{
"PHOENIX_API_KEY": "test_api_key",
"PHOENIX_COLLECTOR_ENDPOINT": "grpc://test.endpoint",
},
)
def test_get_arize_phoenix_config_grpc(self):
# Call the function to get the configuration
config = ArizePhoenixLogger.get_arize_phoenix_config()
# Verify the configuration
self.assertEqual(
config.otlp_auth_headers, "Authorization=Bearer%20test_api_key"
)
self.assertEqual(config.endpoint, "grpc://test.endpoint")
self.assertEqual(config.protocol, "otlp_grpc")
if __name__ == "__main__":
unittest.main()