litellm/tests/logging_callback_tests
Alexsander Hamir 2e7b554747
3[Fix] CI/CD - logging_testing (#18204)
* fix: enforce team member budget check in common_checks

- Add missing team member budget validation in common_checks() function
  - Checks team membership budget when team key is used
  - Raises BudgetExceededError when team member spend exceeds max_budget_in_team
  - Follows same pattern as other budget checks (team, user, end_user)
  - Uses cached get_team_membership() for performance

- Fix AttributeError in lowest_tpm_rpm.py
  - Add null check for model_info before accessing .get() method
  - Prevents 'NoneType' object has no attribute 'get' error

- Add unit tests for team member budget enforcement
  - Test budget exceeded scenario
  - Test within budget scenario
  - Test edge cases (no budget, no membership, personal keys)
  - Tests run without requiring proxy server

Fixes failing test: test_users_in_team_budget

* fix: mock get_async_httpx_client in test_langsmith_key_based_logging

- Mock get_async_httpx_client to return a mock AsyncHTTPHandler instance
- Fixes test failure where mock_post was never called
- LangsmithLogger creates its own httpx client instance via get_async_httpx_client,
  so we need to mock the factory function rather than the class method
- Use MagicMock for response.raise_for_status (sync method) instead of AsyncMock

* fix: resolve linting errors (PLR0915, F401)

- Remove unused imports (datetime, ServiceLoggerPayload) from arize_phoenix.py
- Extract health ping setup logic from RedisCache.__init__ to reduce statement count
- Extract team member budget check from common_checks to reduce statement count

* fix: resolve type errors in ChatCompletionToolCallChunk construction

- Cast type field to Literal['function'] to satisfy TypedDict requirements
- Ensure arguments field is explicitly str type to match TypedDict signature
- Fixes pyright errors for incompatible types in transformation.py
2025-12-18 10:52:24 -08:00
..
gcs_pub_sub_body fix: add agent_id field to GCS PubSub spend_logs_payload.json test expectation (#17938) 2025-12-13 13:35:20 -08:00
langfuse_expected_request_body test logging tests + mcp server QA checks 2025-11-15 08:58:46 -08:00
base_test.py
conftest.py
create_mock_standard_logging_payload.py
gettysburg.wav
log.txt
test_alerting.py Fix/organization max budget not enforced (#17334) 2025-12-02 22:46:03 -08:00
test_amazing_s3_logs.py
test_assemble_streaming_responses.py
test_azure_blob_storage.py
test_bedrock_knowledgebase_hook.py
test_built_in_tools_cost_tracking.py
test_custom_callback_router.py
test_datadog_llm_obs.py
test_datadog.py Fix: Datadog callback regression when ddtrace is installed (#17393) 2025-12-02 17:27:50 -08:00
test_gcs_pub_sub.py Fixing test 2 2025-12-16 13:44:53 -08:00
test_generic_api_callback.py make generic api OSS + support multiple generic API's (#17152) 2025-11-26 18:38:38 -08:00
test_humanloop_unit_tests.py
test_langfuse_e2e_test.py
test_langfuse_unit_tests.py feat(langfuse): Add support for custom masking function (#17826) 2025-12-11 15:36:54 -08:00
test_langsmith_unit_test.py 3[Fix] CI/CD - logging_testing (#18204) 2025-12-18 10:52:24 -08:00
test_log_db_redis_services.py
test_logging_redaction_e2e_test.py
test_moderations_api_logging.py
test_opentelemetry_unit_tests.py test_opentelemetry_integration 2025-11-26 12:28:47 -08:00
test_otel_logging.py
test_pagerduty_alerting.py
test_posthog.py
test_spend_logs.py
test_sqs_logger.py
test_standard_logging_payload.py
test_token_counting.py
test_unit_test_litellm_logging.py
test_unit_tests_init_callbacks.py test_init_custom_logger_compatible_class_as_callback 2025-12-06 16:21:50 -08:00
test_view_request_resp_logs.py