Repository navigation
Fix xdist collisions for captured_info artifacts and preserve CI debug logs - #45645
stationeros wants to merge 14 commits into
Conversation
|
Hi, In xdist mode, only the current worker’s captured_info file is removed at startup, so if the output directory is reused, old captured_info_.txt files from prior runs can persist and be merged/printed as if they belong to the current run. Severity: remediation recommended | Category: correctness How to fix: Clear outputs at run start Agent prompt to fix - you can give this to your LLM of choice:
Qodo code review - free for open-source. |
|
@ydshieh Can you help review this ? |
|
Thanks for looking into the xdist |
What does this PR do?
Fixes #45561.
This PR fixes a race in the test failure reporting flow when the suite is run with
pytest-xdist.Right now every worker writes debug output to the same
captured_info.txtfile. In parallel runs that means workers can overwrite each other’s output, and in some cases one worker can remove the file another worker was still relying on. The end result is flaky or incomplete failure logs, which makes CI failures much harder to debug.The fix keeps the current behavior for non-xdist runs, but switches to worker-specific files when
PYTEST_XDIST_WORKERis set. So instead of multiple workers all writing to the same file, each one writes its owncaptured_info_<worker>.txt.Along with that, this PR also updates the surrounding plumbing so the debug info still shows up where people expect it:
captured_info*.txtfiles instead of assuming there is only one.captured_info*.txtfiles are cleaned up before a new collection starts so repeated runs do not pick up leftovers from earlier failures.I also added tests covering:
Code Agent Policy
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
This touches test infrastructure / CI behavior, so @ydshieh seems like the most relevant reviewer.