Allow mypy to output a junit file with per-file results #16388
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a new
--junit-format
flag to MyPy, which affects the structure of the junit file written when--junit-xml
is specified (it has no effect when not writing a junit file). This flag can takeglobal
orper_file
as values:--junit-format=global
(the default) preserves the existing junit structure, creating a junit file specifying a single "test" for the entire mypy run.--junit-format=per_file
will cause the junit file to have one test entry per file with failures (or a single entry, as in the existing behavior, in the case when typechecking passes).In some settings it can be useful to know which files had typechecking failures (for example, a CI system might want to display failures by file); while that information can be parsed out of the error messages in the existing junit files, it's much more convenient to have that represented in the junit structure.
Tests for the old and new junit structure have been added.