litellm/tests/logging_callback_tests
Yuneng Jiang a5b84d337a
test: address review on the restored SQS tests
Greptile flagged that the newly collected SQS tests construct SQSLogger without
mocking asyncio.create_task, so the constructor's periodic_flush task
(while True: sleep; flush_queue) is left running on the session-scoped event
loop. That is correct, and checking each test against the survivor that shadowed
it changes the answer for two of the three.

test_async_log_success_event_adds_to_queue and its failure variant assert exactly
what their survivors assert, that the payload lands in log_queue. The only
difference is whether create_task is mocked, and nothing asserts anything about
that, so restoring them added a leaked task for no coverage. Both renames are
reverted; those definitions stay shadowed and belong in a deletion set instead.

test_async_send_batch keeps its rename. Its assertion, that async_send_message is
not awaited inline, is only meaningful with a real create_task: under a MagicMock
the await count is trivially zero. So it now wraps the real create_task in a spy
that records the tasks and cancels them in a finally block, which covers both the
periodic_flush task and the dispatched send.

Verification against staging for tests/logging_callback_tests/test_sqs_logger.py:
17 passed and 2 "periodic_flush was never awaited" warnings before, 18 passed and
the same 2 after, so the restored test adds no leak. Those 2 warnings are
pre-existing and come from the survivors mocking create_task with MagicMock.
Across the seven touched files, collection goes from 401 to 409 with nothing
lost, and all 409 pass.
2026-08-12 11:47:11 -07:00
..
gcs_pub_sub_body test(logging): pin routing_decision and internal_call_origin in the gcs pubsub spend log fixture 2026-08-01 14:34:04 -07:00
langfuse_expected_request_body
base_test.py
conftest.py test(vcr): close out the remaining VCR live-call leaks (#29603) 2026-06-03 13:46:43 -07:00
create_mock_standard_logging_payload.py
gettysburg.wav
log.txt
test_alerting.py
test_amazing_s3_logs.py test(vcr): close out the remaining VCR live-call leaks (#29603) 2026-06-03 13:46:43 -07:00
test_assemble_streaming_responses.py
test_bedrock_knowledgebase_hook.py Revert "chore(tests): migrate Bedrock CI to AWS account 941277531214 (#28728)" (#29326) 2026-05-30 11:26:24 -07:00
test_built_in_tools_cost_tracking.py
test_custom_callback_router.py
test_datadog.py
test_datadog_llm_obs.py
test_dynamic_otel_keys.py
test_gcs_pub_sub.py feat(spend): store litellm_call_id on spend logs for DB-to-trace correlation (#31344) 2026-06-25 17:45:37 -07:00
test_generic_api_callback.py
test_humanloop_unit_tests.py
test_langfuse_dynamic_credentials.py
test_langfuse_e2e_test.py
test_langfuse_unit_tests.py
test_langsmith_dynamic_credentials.py
test_langsmith_unit_test.py
test_log_db_redis_services.py fix(ci): make litellm_internal_staging green (logging test + Bedrock Opus 4.7 self-heal) (#29344) 2026-05-30 13:57:18 -07:00
test_logging_redaction_e2e_test.py fix: redact async complete streaming response for custom callbacks (#33106) 2026-07-13 13:35:14 -07:00
test_moderations_api_logging.py
test_opentelemetry_unit_tests.py
test_otel_logging.py
test_pagerduty_alerting.py
test_posthog.py
test_spend_logs.py
test_sqs_logger.py test: address review on the restored SQS tests 2026-08-12 11:47:11 -07:00
test_standard_logging_payload.py feat(logging): add opt-in session_id and trace_id correlation to JSON log records via contextvars (#34418) 2026-08-10 10:40:13 -07:00
test_standard_logging_payload_excluded_fields.py
test_token_counting.py
test_unit_test_litellm_logging.py
test_unit_tests_init_callbacks.py
test_view_request_resp_logs.py