Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mitigate directory creation race condition #10607

Merged
merged 3 commits into from Jan 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/_pytest/junitxml.py
Expand Up @@ -646,7 +646,7 @@ def pytest_sessionstart(self) -> None:
def pytest_sessionfinish(self) -> None:
dirname = os.path.dirname(os.path.abspath(self.logfile))
if not os.path.isdir(dirname):
os.makedirs(dirname)
os.makedirs(dirname, exist_ok=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably makes sense to also remove the if condition. Also probably nice to leave a comment in the code explaining the rationale around that.

Other than that, can you please also add a changelog entry as "bugfix"?


with open(self.logfile, "w", encoding="utf-8") as logfile:
suite_stop_time = timing.time()
Expand Down