Skip to content

Commit 13e7213

Browse files
authored
Add exist_ok=True in write_junit_xml (#16637)
Fixes #16630
1 parent cbbcdb8 commit 13e7213

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mypy/util.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,9 @@ def write_junit_xml(
314314
) -> None:
315315
xml = _generate_junit_contents(dt, serious, messages_by_file, version, platform)
316316

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

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

0 commit comments

Comments
 (0)