mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix(claude_code/conftest): allow xdist controller to merge worker shards
The previous early-return guard in pytest_sessionfinish exited before the merge step for the xdist controller process: the controller never runs tests itself (so _COLLECTOR.items is empty) and is not detected as a worker (it has no workerinput), so the guard always tripped. Worker shards were written but no process ever produced the canonical compat-results.json. Also check for shards on disk so the controller still proceeds to merge them under pytest -n auto. Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
parent
a1c4f0fc12
commit
e886f3fec8
1 changed files with 9 additions and 2 deletions
|
|
@ -419,11 +419,18 @@ def pytest_sessionfinish(session, exitstatus):
|
|||
unit-test trees (e.g. `_driver_unit_tests/`). Writing an empty
|
||||
artifact would silently overwrite a real artifact from a prior
|
||||
compat-test run on the same checkout.
|
||||
|
||||
The xdist controller hits this hook with `_COLLECTOR.items` empty
|
||||
(it never executes tests itself) and `_is_xdist_worker` False, so
|
||||
we additionally allow the merge step to run when worker shards
|
||||
are already on disk — otherwise the canonical artifact would
|
||||
never be produced under `pytest -n auto`.
|
||||
"""
|
||||
if not _COLLECTOR.items and not _is_xdist_worker(session):
|
||||
return
|
||||
artifact_path = Path(os.environ.get(RESULTS_ARTIFACT_ENV) or DEFAULT_ARTIFACT_PATH)
|
||||
shard_dir = _shard_dir(artifact_path)
|
||||
has_worker_shards = shard_dir.is_dir() and any(shard_dir.glob("*.json"))
|
||||
if not _COLLECTOR.items and not _is_xdist_worker(session) and not has_worker_shards:
|
||||
return
|
||||
shard_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
worker_id = _xdist_worker_id(session) or "main"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue