From d81e8148aa191054f89bc7ad1992dba8ffe8f17b Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Wed, 17 Sep 2025 23:27:31 +0700 Subject: [PATCH 1/5] Update main.py: junit --help Elaborate on the information given in --help for junit, to make it more correct and comprehensive. --- mypy/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mypy/main.py b/mypy/main.py index b543cd33fe44..209b81c4130d 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -1165,12 +1165,12 @@ def add_invertible_flag( misc_group = parser.add_argument_group(title="Miscellaneous") misc_group.add_argument("--quickstart-file", help=argparse.SUPPRESS) - misc_group.add_argument("--junit-xml", help="Write junit.xml to the given file") + misc_group.add_argument("--junit-xml", metavar="JUNIT_XML_OUTPUT_FILE", help="Write a JUnit XML test result document with type checking results to the given file") imports_group.add_argument( "--junit-format", choices=["global", "per_file"], default="global", - help="If --junit-xml is set, specifies format. global: single test with all errors; per_file: one test entry per file with failures", + help="If --junit-xml is set, specifies format. global (default): single test with all errors; per_file: one test entry per file with failures", ) misc_group.add_argument( "--find-occurrences", From c05df76c61552afa1acdf2f5c6c16e22aacdff01 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 17 Sep 2025 16:32:35 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mypy/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mypy/main.py b/mypy/main.py index 209b81c4130d..c9163a651428 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -1165,7 +1165,11 @@ def add_invertible_flag( misc_group = parser.add_argument_group(title="Miscellaneous") misc_group.add_argument("--quickstart-file", help=argparse.SUPPRESS) - misc_group.add_argument("--junit-xml", metavar="JUNIT_XML_OUTPUT_FILE", help="Write a JUnit XML test result document with type checking results to the given file") + misc_group.add_argument( + "--junit-xml", + metavar="JUNIT_XML_OUTPUT_FILE", + help="Write a JUnit XML test result document with type checking results to the given file", + ) imports_group.add_argument( "--junit-format", choices=["global", "per_file"], From a1a7897ea646221d075c8ab667f418f5de28dee2 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Wed, 17 Sep 2025 23:54:25 +0700 Subject: [PATCH 3/5] put junit format into misc group not import group the inclusion into imports group seems to have been a mistake in https://github.com/python/mypy/pull/16388/ although one could perhaps argue it is tangentially related to imports in some way. But it does not influence import discovery, unlike the other options. --- mypy/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/main.py b/mypy/main.py index c9163a651428..9ebbf78ded09 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -1170,7 +1170,7 @@ def add_invertible_flag( metavar="JUNIT_XML_OUTPUT_FILE", help="Write a JUnit XML test result document with type checking results to the given file", ) - imports_group.add_argument( + misc_group.add_argument( "--junit-format", choices=["global", "per_file"], default="global", From ed04633d51d2ef55a99f5b6cb2c81171c7dde6ea Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Thu, 18 Sep 2025 00:01:27 +0700 Subject: [PATCH 4/5] Update command_line.rst: reflect current --help info --- docs/source/command_line.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index c1b757a00ef2..270125e96cb6 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -1255,12 +1255,18 @@ Miscellaneous stub packages were found, they are installed and then another run is performed. -.. option:: --junit-xml JUNIT_XML +.. option:: --junit-xml JUNIT_XML_OUTPUT_FILE Causes mypy to generate a JUnit XML test result document with type checking results. This can make it easier to integrate mypy with continuous integration (CI) tools. +.. option:: --junit-format {global,per_file} + + If --junit-xml is set, specifies format. + global (default): single test with all errors; + per_file: one test entry per file with failures. + .. option:: --find-occurrences CLASS.MEMBER This flag will make mypy print out all usages of a class member From caaa82351c4107971f8d46c72093f8e136ac1086 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Thu, 18 Sep 2025 01:19:21 +0700 Subject: [PATCH 5/5] Update config_file.rst: add junit_format --- docs/source/config_file.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/source/config_file.rst b/docs/source/config_file.rst index 934e465a7c23..7abd1f02db68 100644 --- a/docs/source/config_file.rst +++ b/docs/source/config_file.rst @@ -1153,6 +1153,15 @@ These options may only be set in the global section (``[mypy]``). type checking results. This can make it easier to integrate mypy with continuous integration (CI) tools. +.. confval:: junit_format + + :type: string + :default: ``global`` + + If junit_xml is set, specifies format. + global (default): single test with all errors; + per_file: one test entry per file with failures. + .. confval:: scripts_are_modules :type: boolean