`test_update_data` fails when `-x` is in `PYTEST_ADDOPTS`
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führen Sie zunächst den gemeldeten tox-Befehl gegen mypy/test/meta/test_update_data.py aus und vergleichen Sie ihn anschließend mit dem erfolgreichen Befehl, bei dem -x am Ende angegeben wird. Untersuchen Sie, wie dieser Test mit pytest-Optionen umgeht, und aktualisieren Sie sein Verhalten so, dass der Test sowohl mit -x in PYTEST_ADDOPTS als auch in der Befehlszeile besteht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100