python / python/cpython

Make Memory-Related Tests Less Fragile

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

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

tests type-feature
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Feature or enhancement

Proposal:

There are a number of tests that check various aspects of memory management, typically related to some specific module or feature. Nearly every one of these tests is fairly tightly coupled to the fine details of our memory management implementation, usually tied to specific numbers.

This makes the tests fragile, often breaking with even slight changes to some aspect of memory management. [^1]

[^1]: To be fair, we don't make changes to memory management very often; clearly these tests aren't breaking all the time.

For example, in https://github.com/python/cpython/pull/121134#issuecomment-2233412265, @Fidget-Spinner says:

It fails

    test.test_gdb.test_pretty_print test_capi test_exceptions
    test_regrtest test_repl test_sys test_tracemalloc

mainly because they count allocations/test out of memory situations, and the hashtable adds random allocations which breaks their careful calculations.

[^2]

[^2]: Note that those aren't necessarily the only tests that need attention here.

Ideally, we would find a way to make such tests less coupled to specific numbers, without sacrificing the accuracy of the behavior checks they are making.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

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

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

はじめの一歩

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

調査の方向性

まず、issue で指定されているメモリ依存のテストを確認します: test_gdb.test_pretty_print、test_capi、test_exceptions、test_regrtest、test_repl、test_sys、test_tracemalloc。どのアロケーションまたはメモリ不足のアサーションが固定値に依存しているかを特定し、その後、それらの正確な数値なしでも動作のチェックを正確に保つ方法を判断します。影響を受けるテストが関連するメモリ管理の変更に耐えながら、引き続きリグレッションを検出できれば完了です。

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

評価

技術スタック
python
領域
testing-qa
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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