This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_nntplib depends on unreliable external servers
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.11
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: chris.jerdonek, iritkatriel, vstinner, zach.ware
Priority: normal Keywords:

Created on 2020-05-22 21:07 by chris.jerdonek, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg369648 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2020-05-22 21:07
A sporadic failure of test_nntplib.NetworkedNNTP_SSLTests.test_with_statement on the CI for macOS:
https://github.com/python/cpython/pull/20321/checks?check_run_id=700729471#step:6:612

See also:
* https://bugs.python.org/issue19613 (test_article_head_body)
* https://bugs.python.org/issue19756 (test_capabilities)

ERROR: test_with_statement (test.test_nntplib.NetworkedNNTP_SSLTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/test/test_nntplib.py", line 277, in test_with_statement
    server = self.NNTP_CLASS(self.NNTP_HOST,
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/nntplib.py", line 1025, in __init__
    super().__init__(host, port, user, password, readermode,
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/nntplib.py", line 334, in __init__
    self.sock = self._create_socket(timeout)
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/nntplib.py", line 1031, in _create_socket
    sock = _encrypt_on(sock, self.ssl_context, self.host)
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/nntplib.py", line 292, in _encrypt_on
    return context.wrap_socket(sock, server_hostname=hostname)
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1097)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/test/test_nntplib.py", line 250, in wrapped
    meth(self)
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/test/test_nntplib.py", line 293, in test_with_statement
    if re.search(r'(?i)KEY.TOO.SMALL', ssl_err.reason):
  File "/Users/runner/runners/2.262.1/work/cpython/cpython/Lib/re.py", line 201, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object
msg411529 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-24 23:26
Following discussion with Zach and Victor: This is probably an issue with the external servers these tests used. The fix would be to rewrite the tests so that they don't rely on external infrastructure.
msg411649 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-01-25 18:00
IMO for now it's better to *always* skip test_nnptlib tests which rely on external servers and close related issues.

* https://bugs.python.org/issue19613 (test_article_head_body)
* https://bugs.python.org/issue19756 (test_capabilities)

These issues are open for 9 years. NNTP protocol is getting less and less popular, I don't expect that anyone will come in 2022 and suddenly propose a fix.
msg415081 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-13 19:06
nntplib is deprecated as per PEP 594, so there won't be further enhancements to it.
msg415150 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-03-14 15:50
It tomorrow a test_nntplib test fails too often, I suggest to simply skip it, since PEP 594 is accepted. Especially tests using external real NNTP servers.
History
Date User Action Args
2022-04-11 14:59:31adminsetgithub: 84912
2022-03-14 15:50:45vstinnersetmessages: + msg415150
2022-03-13 19:06:04iritkatrielsetstatus: open -> closed
resolution: wont fix
messages: + msg415081

stage: resolved
2022-01-25 18:00:18vstinnersetmessages: + msg411649
2022-01-24 23:26:00iritkatrielsetnosy: + iritkatriel, vstinner, zach.ware
title: test_nntplib: sporadic failures, NetworkedNNTP_SSLTests.test_with_statement -> test_nntplib depends on unreliable external servers
messages: + msg411529

versions: + Python 3.11
type: behavior -> enhancement
2020-05-22 21:07:45chris.jerdonekcreate