Skip to content

Commit

Permalink
Add exist_ok=True in write_junit_xml (python#16637)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukin0110 authored Dec 8, 2023
1 parent cbbcdb8 commit 13e7213
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mypy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,9 @@ def write_junit_xml(
) -> None:
xml = _generate_junit_contents(dt, serious, messages_by_file, version, platform)

# checks for a directory structure in path and creates folders if needed
# creates folders if needed
xml_dirs = os.path.dirname(os.path.abspath(path))
if not os.path.isdir(xml_dirs):
os.makedirs(xml_dirs)
os.makedirs(xml_dirs, exist_ok=True)

with open(path, "wb") as f:
f.write(xml.encode("utf-8"))
Expand Down

0 comments on commit 13e7213

Please sign in to comment.