Skip to content

Commit feeb3f0

Browse files
[docs] main.py: junit documentation elaboration (#19867)
Elaborate on the information given in --help and command_line.rst for junit, to make it more correct and comprehensive. I manually examined the generated results and found them satisfactory. Note that this also puts --junit-format into misc group not import group; the inclusion into imports group seems to have been a mistake in #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. Putting it into import group also makes it display in a completely different place, which is not as helpful as right next to its related option.
1 parent e1aada8 commit feeb3f0

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

docs/source/command_line.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,12 +1255,18 @@ Miscellaneous
12551255
stub packages were found, they are installed and then another run
12561256
is performed.
12571257

1258-
.. option:: --junit-xml JUNIT_XML
1258+
.. option:: --junit-xml JUNIT_XML_OUTPUT_FILE
12591259

12601260
Causes mypy to generate a JUnit XML test result document with
12611261
type checking results. This can make it easier to integrate mypy
12621262
with continuous integration (CI) tools.
12631263

1264+
.. option:: --junit-format {global,per_file}
1265+
1266+
If --junit-xml is set, specifies format.
1267+
global (default): single test with all errors;
1268+
per_file: one test entry per file with failures.
1269+
12641270
.. option:: --find-occurrences CLASS.MEMBER
12651271

12661272
This flag will make mypy print out all usages of a class member

docs/source/config_file.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,15 @@ These options may only be set in the global section (``[mypy]``).
11531153
type checking results. This can make it easier to integrate mypy
11541154
with continuous integration (CI) tools.
11551155

1156+
.. confval:: junit_format
1157+
1158+
:type: string
1159+
:default: ``global``
1160+
1161+
If junit_xml is set, specifies format.
1162+
global (default): single test with all errors;
1163+
per_file: one test entry per file with failures.
1164+
11561165
.. confval:: scripts_are_modules
11571166

11581167
:type: boolean

mypy/main.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,12 +1165,16 @@ def add_invertible_flag(
11651165

11661166
misc_group = parser.add_argument_group(title="Miscellaneous")
11671167
misc_group.add_argument("--quickstart-file", help=argparse.SUPPRESS)
1168-
misc_group.add_argument("--junit-xml", help="Write junit.xml to the given file")
1169-
imports_group.add_argument(
1168+
misc_group.add_argument(
1169+
"--junit-xml",
1170+
metavar="JUNIT_XML_OUTPUT_FILE",
1171+
help="Write a JUnit XML test result document with type checking results to the given file",
1172+
)
1173+
misc_group.add_argument(
11701174
"--junit-format",
11711175
choices=["global", "per_file"],
11721176
default="global",
1173-
help="If --junit-xml is set, specifies format. global: single test with all errors; per_file: one test entry per file with failures",
1177+
help="If --junit-xml is set, specifies format. global (default): single test with all errors; per_file: one test entry per file with failures",
11741178
)
11751179
misc_group.add_argument(
11761180
"--find-occurrences",

0 commit comments

Comments
 (0)