8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 08d0dd0 + a6f85a0 commit 211d08eCopy full SHA for 211d08e
changelog/10607.bugfix.rst
@@ -0,0 +1 @@
1
+Fix a race condition when creating junitxml reports, which could occur when multiple instances of pytest execute in parallel.
src/_pytest/junitxml.py
@@ -645,8 +645,8 @@ def pytest_sessionstart(self) -> None:
645
646
def pytest_sessionfinish(self) -> None:
647
dirname = os.path.dirname(os.path.abspath(self.logfile))
648
- if not os.path.isdir(dirname):
649
- os.makedirs(dirname)
+ # exist_ok avoids filesystem race conditions between checking path existence and requesting creation
+ os.makedirs(dirname, exist_ok=True)
650
651
with open(self.logfile, "w", encoding="utf-8") as logfile:
652
suite_stop_time = timing.time()
0 commit comments