`test_subprocess` is flaky under `PYTHONWARNINGS=ignore`
オープン
まだ誰も着手していません。
tests
topic-subprocess
type-bug
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Feature or enhancement
Proposal:
make test
my env has a export PYTHONWARNINGS=ignore
make test will fall
FAIL: test_encoding_warning (test.test_subprocess.RunFuncTestCase.test_encoding_warning)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/hyi/prs/cpython/Lib/test/test_subprocess.py", line 1837, in test_encoding_warning
self.assertEqual(len(lines), 2, lines)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 != 2 : []
at first I thought it is not a big deal
but I checked the code
class Test_TextTestRunner(unittest.TestCase):
"""Tests for TextTestRunner."""
def setUp(self):
# clean the environment from pre-existing PYTHONWARNINGS to make
# test_warnings results consistent
self.pythonwarnings = os.environ.get('PYTHONWARNINGS')
if self.pythonwarnings:
del os.environ['PYTHONWARNINGS']
def tearDown(self):
# bring back pre-existing PYTHONWARNINGS if present
if self.pythonwarnings:
existing code can aviod this.
so I thought it may be can enhance
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-138637
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Lib/test/test_subprocess.py の RunFuncTestCase.test_encoding_warning から始め、次に、関連するテストコードに示されている PYTHONWARNINGS のクリーンアップパターンを確認します。PYTHONWARNINGS=ignore を指定して make test を実行し、subprocess の警告テストが期待される 2 行を生成し、既存の環境処理に影響を与えないことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- testing-qa
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100