python / python/mypy

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

Abierto
#16,265 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug topic-tests
Lenguaje dominante
Python
Estrellas
20.6k
Forks
3.3k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza ejecutando el comando tox reportado contra mypy/test/meta/test_update_data.py y compáralo después con el comando que pasa cuando se proporciona -x al final. Inspecciona cómo maneja este test las opciones de pytest y actualiza su comportamiento para que el test pase tanto con -x en PYTEST_ADDOPTS como en la línea de comandos.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
testing-qa
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.