python / python/mypy

Invalid JUnit XML being generated due to <type> hint

Aperta
#16,915 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug topic-error-reporting
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il report con l’esempio Python fornito e il comando --junit-xml ./mypy-report.xml, quindi esamina il percorso di generazione dell’XML JUnit. L’attività è completata quando il report generato è XML valido quando le diagnosi contengono l’indicazione <type>, incluso il caso segnalato no-untyped-def.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
testing
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.