python / python/cpython

`test_ssl` is too verbose

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

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

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

説明

Feature or enhancement

  • turn loud but ignored server tracebacks into silent exceptions passed straight to a main thread for assertRaises checks. An example of how it's currently (note "ok" in the last line):

    test_connect_ex (test.test_ssl.SimpleBackgroundTests.test_connect_ex) ...  server:  new connection from ('127.0.0.1', 51236)
     
    server:  bad connection attempt from ('127.0.0.1', 51236):
    Traceback (most recent call last):
       File "D:\a\cpython\cpython\Lib\test\test_ssl.py", line 2371, in wrap_conn
        self.sslconn = self.server.context.wrap_socket(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       File "D:\a\cpython\cpython\Lib\ssl.py", line 455, in wrap_socket
        return self.sslsocket_class._create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       File "D:\a\cpython\cpython\Lib\ssl.py", line 1013, in _create
        self.do_handshake()
        ^^^^^^^^^^^^^^^^^^^
       File "D:\a\cpython\cpython\Lib\ssl.py", line 1284, in do_handshake
        self._sslobj.do_handshake()
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
    ok
    
  • stop printing a dialog between a client and a server; use the same assertion mechanism instead. An example:

    test_alpn_protocols (test.test_ssl.ThreadedTests.test_alpn_protocols) ...  server:  new connection from ('127.0.0.1', 51305)
     client:  sending b'FOO\n'...
     server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256)
     client:  read b'foo\n'
     client:  sending b'FOO\n'...
     client:  read b'foo\n'
     client:  sending b'FOO\n'...
     client:  read b'foo\n'
     client:  closing connection.
     server:  new connection from ('127.0.0.1', 51307)
     client:  sending b'FOO\n'...
     server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256)
     client:  read b'foo\n'
     client:  sending b'FOO\n'...
     client:  read b'foo\n'
     client:  sending b'FOO\n'...
     client:  read b'foo\n'
     client:  closing connection.
     server:  new connection from ('127.0.0.1', 51309)
     client:  sending b'FOO\n'...
     server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256)
     client:  read b'foo\n'
     client:  sending b'FOO\n'...
     client:  read b'foo\n'
     client:  sending b'FOO\n'...
     client:  read b'foo\n'
     client:  closing connection.
     server:  new connection from ('127.0.0.1', 51311)
     client:  sending b'FOO\n'...
     server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256)
     client:  read b'foo\n'
     client:  sending b'FOO\n'...
     client:  read b'foo\n'
     client:  sending b'FOO\n'...
     client:  read b'foo\n'
     client:  closing connection.
    ok
    

Pitch

While (almost) all tests keep silence, test_ssl reports every nit into a console making the log bloated (>1200 lines) to the degree of being unusable for failure tracking.

In addition, all these reports must be looked through manually. Assertions should be used instead.

Linked PRs
  • gh-92475

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

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

はじめの一歩

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

調査の方向性

Lib/test/test_ssl.py から始め、特に issue に示されているサーバーとクライアントのインタラクションパスを確認し、test.test_ssl が現在どのように traceback とダイアログを報告しているかを調べます。関連する test.test_ssl のケースを実行して、ノイズの多い出力を確認します。完了条件は、無視されたサーバーの失敗がアサーションのためにメインスレッドへ到達し、クライアントとサーバー間のやり取りで進捗が出力されなくなることです。ただし、リンクされた PR を最初に確認する必要があります。

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

評価

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

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

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