Invalid JUnit XML being generated due to <type> hint

オープン
#16,915 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
testing

調査の方向性

提供された Python の例と --junit-xml ./mypy-report.xml コマンドを使ってレポートを再現し、その後 JUnit XML の生成パスを調査します。診断に <type> ヒントが含まれている場合でも、生成されたレポートが有効な XML になっていれば完了です。報告されている no-untyped-def のケースも含みます。

索引モデルが issue の本文から書いたものです。

説明

bug topic-error-reporting

Bug Report
The JUnit XML generated by MyPy is invalid.

To Reproduce
Create a list without a type annotation and generate a JUnit XML report using MyPy.

def dummy_function():
    abc = []
    for i in ["asd", 123]:
        abc.append(i)

Expected Behavior
I expect a valid XML document to be generated.

Actual Behavior
The XML is unable to be parsed due to a mismatched tag. I believe this is because of the presence of a <type> mask in a hint.
error: Need type annotation for "abc" (hint: "abc: List[<type>] = ...")

This is the XML error message that is displayed

XML Parsing Error: mismatched tag. Expected: </type>
Location: [file_path]
Line Number XXX, Column XXX:

[Error location]:8: error: Function is missing a type annotation [no-untyped-def]</failure>

Your Environment
Mac with Sonoma 14.3 and using the Poetry package manager

  • Mypy version used: 1.8.0
  • Mypy command-line flags: --explicit-package-bases --strict --junit-xml ./mypy-report.xml
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.10
主要言語
Python
スター
20.6k
フォーク
3.3k
平均マージ
1日 18時間
マージ済み PR(30日)
54

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python/mypy のほかの issue

python/mypy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。