litellm/tests/unit/a2a_protocol
yuneng-jiang 1587faeeb9
test(unit): wait on the work itself instead of fixed sleeps (#46261)
* test(unit): wait on the work itself instead of fixed sleeps in 21 flaky files

Replace sleeps that raced background logging, cache writes, refreshes and
thread work with either awaiting that work directly (logging worker flush,
the batch logger's flush_queue, the tasks the call spawned, thread joins) or
an Event the test's own fake sets when it runs. Each wait keeps a 5s hang
guard that never decides pass or fail. Tests that need a fake clock, real
sockets, or measure latency are left unchanged, and no production code moves

* test(unit): await the tasks each completion spawns instead of yielding once

The logging tests yielded once with asyncio.sleep(0) so the task that
enqueues the success log could run before the worker flush. That relied
on the enqueue happening before the task's first await. Snapshot the
running tasks around each acompletion call and await the ones it spawned,
so the guarantee holds however many steps sit before the enqueue
2026-10-13 12:41:06 -07:00
..
providers refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00
__init__.py test: add __init__.py to migrated tests/unit packages 2026-09-20 11:53:49 +00:00
test_a2a_exception_mapping_utils.py fix(a2a): add per-agent a2a_protocol_version override for langgraph-api 0.15 cards (#44463) 2026-10-13 09:04:36 -04:00
test_a2a_streaming_iterator.py test: move tests/test_litellm core utils, routing, responses, caching and rust_bridge into tests/unit (#43199) 2026-09-25 17:10:13 -07:00
test_card_resolver.py fix(a2a): add per-agent a2a_protocol_version override for langgraph-api 0.15 cards (#44463) 2026-10-13 09:04:36 -04:00
test_completion_bridge_streaming.py fix(a2a): add per-agent a2a_protocol_version override for langgraph-api 0.15 cards (#44463) 2026-10-13 09:04:36 -04:00
test_cost_calculator.py test(unit): wait on the work itself instead of fixed sleeps (#46261) 2026-10-13 12:41:06 -07:00
test_main.py fix(a2a): add per-agent a2a_protocol_version override for langgraph-api 0.15 cards (#44463) 2026-10-13 09:04:36 -04:00
test_send_message_response.py test(a2a): migrate a2a_protocol legacy tests to tests/unit 2026-09-20 19:23:52 +00:00
test_utils.py test(a2a): migrate a2a_protocol legacy tests to tests/unit 2026-09-20 19:23:52 +00:00