Filesystem race condition in junitxml #10604
Labels
good first issue
easy issue that is friendly to new contributor
plugin: junitxml
related to the junitxml builtin plugin
type: bug
problem that needs to be addressed
PyTest can intermittently fail when finalizing the run, if flag
--junitxml=<path_to_file.xml>
is set. This causes to errors similar to:This appears to primarily happen when running multiple invocations of pytest in parallel interpreters, where two instances may try to create the same folder at the same time. Though this has also reproduced in a self-test of a plugin, which invoked pytest within the context of another pytest run.
This has reproduced on pytest
6.2.5
and7.2.0
on both Windows and Linux.Output of
pip list
is attached piplist.txtI am currently testing a fix to this by monkeypatching https://github.com/pytest-dev/pytest/blob/7.2.x/src/_pytest/junitxml.py#L649 to use
os.makedirs(dirname, exist_ok=True)
...but I plan to collect more data on whether other race conditions still exist before proposing a PR.The text was updated successfully, but these errors were encountered: