python / python/mypy

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

オープン
#16,265 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug topic-tests
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、報告された tox コマンドを mypy/test/meta/test_update_data.py に対して実行し、その後、末尾に -x を指定すると成功するコマンドと比較します。このテストが pytest オプションをどのように扱っているかを調べ、PYTEST_ADDOPTS に -x を指定した場合とコマンドラインで指定した場合の両方でテストが成功するように動作を更新します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。