python / python/mypy

`test_update_data` fails when `-x` is in `PYTEST_ADDOPTS`

Aperta
#16,265 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Bug Report

When I run tests for mypy-1.6.0 and -x is in PYTEST_ADDOPTS then test_update_data fails.

To Reproduce

The following command fails:

PYTEST_ADDOPTS="-x" PATH=/usr/gcc/10/bin:$PATH /usr/bin/tox --recreate -e py39 -- mypy/test/meta/test_update_data.py -vv

Expected Behavior

Interestingly, the following passes (please note -x at the end of line):

PYTEST_ADDOPTS="" PATH=/usr/gcc/10/bin:$PATH /usr/bin/tox --recreate -e py39 -- mypy/test/meta/test_update_data.py -vv -x

Actual Behavior

The relevant part of the output:

E           [case testMissingMultiline]
E           s: str = 42;  i: int = 'foo'  # E: Incompatible types in assignment (expression has type "int", variable has type "str") \
E                                         # E: Incompatible types in assignment (expression has type "str", variable has type "int")
E
E           [case testExtraneous]
E         - s: str = 'foo'
E         + s: str = 'foo'  # E: wrong error
E
E           [case testExtraneousMultiline]
E         - s: str = 'foo'
E         + s: str = 'foo'  # E: foo                             # E: bar
E
E           [case testExtraneousMultilineNonError]
E         - s: str = 'foo'
E         + s: str = 'foo'  # W: foo                             # N: bar
E
E           [case testOutCorrect]
E           s: str = 42
E           [out]
E           main:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
E
E           [case testOutWrong]
E           s: str = 42
E           [out]
E         - main:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
E         + main:1: error: foobar
E
E           [case testOutWrongIncremental]
E           s: str = 42
E           [out]
E         - main:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
E         + main:1: error: foobar
E           [out2]
E         - main:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
E         + main:1: error: foobar
E
E           [case testWrongMultipleFiles]
E           import a, b
E         - s: str = 42  # E: Incompatible types in assignment (expression has type "int", variable has type "str")
E         + s: str = 42  # E: foo
E           [file a.py]
E         - s1: str = 42  # E: Incompatible types in assignment (expression has type "int", variable has type "str")
E         + s1: str = 42  # E: bar
E           [file b.py]
E         - s2: str = 43  # E: Incompatible types in assignment (expression has type "int", variable has type "str")
E         + s2: str = 43  # E: baz
E           [builtins fixtures/list.pyi]

Your Environment

  • Mypy version used: 1.6.0
  • Mypy command-line flags: N/A
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.9.16

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

Inizia eseguendo il comando tox segnalato su mypy/test/meta/test_update_data.py, quindi confrontalo con il comando che ha esito positivo quando -x viene fornito alla fine. Esamina come questo test gestisce le opzioni di pytest e aggiorna il suo comportamento in modo che il test abbia esito positivo sia con -x in PYTEST_ADDOPTS sia sulla riga di comando.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.