Errors related to imports different in fine-grained incremental mode

Aperta
#4,398 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start with the test cases in test-data/unit/fine-grained-modules.test, especially testDeletionOfSubmoduleTriggersImportFrom1 and testDeleteTwoFilesErrorsElsewhere, and compare their incremental and non-incremental output. Done means redundant import-related errors are removed, the preferred missing-module message is consistent, and error line numbers match across modes.

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

Descrizione

priority-1-normal topic-fine-grained-incremental

The example from test-data/unit/fine-grained-modules.test illustrates a problem with inconsistent import-related messages:

[case testDeletionOfSubmoduleTriggersImportFrom1]
from p import q
[file p/__init__.py]
[file p/q.py]
[delete p/q.py.2]
[file p/q.py.3]
[out]
==
main:1: error: Cannot find module named 'p.q'
-- TODO: The following messages are different compared to non-incremental mode
main:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
main:1: error: Module 'p' has no attribute 'q'
==

The expected behavior is to show only one of Cannot find module named 'p.q' / Module 'p' has no attribute 'q' (preferably the first alternative) in all modes.

Another test case which illustrates the problem:

[case testDeleteTwoFilesErrorsElsewhere]
import a
import b
a.f()
b.g()
[file a.py]
def f() -> None: pass
[file b.py]
def g() -> None: pass
[delete a.py.2]
[delete b.py.2]
[out]
==
main:1: error: Cannot find module named 'a'
main:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
-- TODO: Remove redundant error message
main:1: error: Cannot find module named 'b'
main:2: error: Cannot find module named 'b'

We should also make sure that error line numbers are consistent.

Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Merge medio
1g 18h
PR unite (30g)
54

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.

Altre issue di python/mypy

Tutte le issue di python/mypy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.