Skip to content

Commit

Permalink
Fix junit writing bug introduced in python#16388
Browse files Browse the repository at this point in the history
  • Loading branch information
mrwright committed Nov 6, 2023
1 parent 8c57df0 commit 48e62fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,12 @@ def maybe_write_junit_xml(
py_version = f"{options.python_version[0]}_{options.python_version[1]}"
if options.junit_format == "global":
util.write_junit_xml(
td, serious, {None: all_messages}, options.junit_xml, py_version, options.platform
td,
serious,
{None: all_messages} if all_messages else {},
options.junit_xml,
py_version,
options.platform,
)
else:
# per_file
Expand Down
7 changes: 6 additions & 1 deletion mypyc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ def emit_messages(options: Options, messages: list[str], dt: float, serious: boo
if options.junit_xml:
py_version = f"{options.python_version[0]}_{options.python_version[1]}"
write_junit_xml(
dt, serious, {None: messages}, options.junit_xml, py_version, options.platform
dt,
serious,
{None: messages} if messages else {},
options.junit_xml,
py_version,
options.platform,
)
if messages:
print("\n".join(messages))
Expand Down

0 comments on commit 48e62fc

Please sign in to comment.