fix(tests): unbreak main — post-#3649 batch stubs and a leaked tracing global (#3668)
* fix(tests): update the batch-retain stubs to the post-#3649 contract
#3649 moved the batch lifecycle onto the impl that `batch_provider_impl()`
resolves — for a multi-LLM chain the first batch-capable member, not necessarily
the primary — and `_build_request_body` now reads model/provider/service tier
off that impl instead of the wrapper. Two hand-built SimpleNamespace stubs still
modelled the old shape and broke main:
* test_causal_relation_offsets stubbed `_provider_impl`, so the batch path hit
`AttributeError: no attribute 'batch_provider_impl'`.
* test_llm_strict_schema hung `openai_service_tier` off a nested
`_provider_impl` that nothing reads any more.
Both now model the impl the code actually calls. The sibling stub in
test_fact_extraction_retry survived because it is a MagicMock(spec=LLMProvider)
— a bare SimpleNamespace accepts any shape and only fails at attribute read.
* fix(tests): shut tracing down after the reflect span test
initialize_tracing flips process-global state (_tracing_enabled, _provider,
_span_recorder) and test_reflect_tracing never turned it back off, so every
later test in the same xdist worker ran with tracing enabled. test_tracing's
three `is_tracing_enabled() is False` / `initialize_tracing_from_config(...) is
False` assertions then failed — intermittently on CI, because whether they broke
depended purely on how xdist distributed the files across workers.
Deterministic repro before the fix:
pytest tests/test_reflect_tracing.py tests/test_tracing.py -n 0
-> 3 failed (test_initialize_tracing_from_config_{disabled,without_endpoint_warns,never_raises})
Same shape as the leaked-span-recorder fail-safe conftest already carries for
#2229; this is the tracing-globals half of it. N
Nicolò Boschi committed
e94b4e1f686e9cde05370760d5e5e25210f442ef
Parent: e20bb29
Committed by GitHub <noreply@github.com>
on 8/20/2026, 12:33:01 PM