You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_nntplib.py", line 251, in wrapped
meth(self)
File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_nntplib.py", line 178, in test_article_head_bodyself.check_article_resp(resp, body, art_num)
File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_nntplib.py", line 158, in check_article_respself.assertNotIn(article.lines[-1], (b".", b".\n", b".\r\n"))
IndexError: list index out of range
(...)
Re-running failed tests in verbose mode
Re-running test 'test_nntplib' in verbose mode
(...)
test_article_head_body (test.test_nntplib.NetworkedNNTPTests) ... ok
Traceback (most recent call last):
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_nntplib.py", line 251, in wrapped
meth(self)
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_nntplib.py", line 229, in test_zlogin
user=baduser, password=badpw, usenetrc=False)
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 704, in assertRaisesreturn context.handle('assertRaises', callableObj, args, kwargs)
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 162, in handle
callable_obj(*args, **kwargs)
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\nntplib.py", line 963, in login
resp =self._shortcmd('authinfo user '+ user)
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\nntplib.py", line 512, in _shortcmdreturnself._getresp()
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\nntplib.py", line 450, in _getresp
resp =self._getline()
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\nntplib.py", line 433, in _getline
line =self.file.readline(_MAXLINE+1)
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\socket.py", line 514, in readintoraiseOSError("cannot read from timed out object")
OSError: cannot read from timed out object
I presume the original report was due to testing when the server happened to return an article with an empty body. The failing test is
# XXX this could exceptionally happen...self.assertNotIn(article.lines[-1], (b".", b".\n", b".\r\n"))
The test code already admits that what it is testing cannot be guaranteed (an article body could end with a full stop). And we have found another case where the test is not valid (an article with zero lines). I say remove this part of the test, at least when testing the article() and body() methods.
Traceback (most recent call last):
File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_nntplib.py", line 240, in wrapped
meth(self)
File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_nntplib.py", line 185, in test_article_head_bodyself.check_article_resp(resp, body, art_num)
File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_nntplib.py", line 165, in check_article_respself.assertNotIn(article.lines[-1], (b".", b".\n", b".\r\n"))
AssertionError: b'.' unexpectedly found in (b'.', b'.\n', b'.\r\n')
A few other buildbots shared this failure. It would be nice to see what the article is that is causing the failure, but I’m fairly confident we should just remove this part of the test.
I played with the server and group that is apparently used in the test:
>>> server = NNTP_SSL("nntp.aioe.org")
>>> [_, _, first, last, _] = server.group("fr.comp.lang.python")
>>> first
2900
>>> last
2915
>>> server.body(last)[1].lines[-1]
b''
>>> server.body(first)[1].lines[-1]
b'Merci'
>>> server.body(last -1)[1].lines[-1]
b'Kevin'
I tried all articles from 2900–2915, and none of them end with a dot on its own line, so I don’t actually know what caused the failure.
However looking again at the _getlongresp() implementation, I cannot imagine how the test failure can occur except for a genuine body that ends with a dot on its own line (encoded as b".." and then converted to b"."). Here is a quick patch to alter the test cases.
Victor opened bpo-32128 with the same complaint. I think I found the offending article:
>>> server = NNTP_SSL("nntp.aioe.org")
>>> [response, count, first, last, name] = server.group("comp.lang.python")
>>> last
199267
>>> pprint(server.article(199265)[1].lines)
[. . .
b'Date: Fri, 24 Nov 2017 15:44:26 -0800 (PST)',
. . .
b'Message-ID: <[email protected]>',
b'Subject: Re: Python loop and web server (bottle) in the same script (Posting',
b' On Python-List Prohibited)',
. . .
b'Content-Transfer-Encoding: quoted-printable',
. . .
b'If processing is I/O bound and not CPU bound, then asyncio should work fine=',
b'.']
The body uses Quoted-printable encoding, and the previous line ends with an equals sign “=”, meaning a soft line break. So the full stop is on its own because the encoder didn’t want to fit it on the previous line. This is valid (albeit quirky) encoding, and not a problem with the NNTP library.
I don't think we should close this issue without re-enabling that test.
The fact is that nobody cares of test_nntplib: this issue is open for 5 years. I don't see how leaving the issue open which helps. It's fine to skip a test if nobody is available to fix it.
Well, no one is going to notice it if we close this issue. I don't see why the age of the issue matters here. We close issues when we fix them. It may take 20 minutes, 5 years or a decade.
I understand closing an issue as "out of date" when we couldn't find the root of the problem, but in this case the problem is obvious and there is already a patch that tries to fix it.
mcepl commented on May 21, 2019
mceplmannequin
Mannequin
More actions
Could anybody make a PR from these patches? @vstinner, would you make me a review if I do it?
Well, yes, see my comment before. With a little bit of help, I would be willing to take over nntplib as a separate module. Especially if with this PR it could became less dependent on the external servers.
Activity
vstinner commentedon Nov 15, 2013
http://buildbot.python.org/all/builders/AMD64%20Ubuntu%20LTS%203.x/builds/3024/steps/test/logs/stdio
======================================================================
ERROR: test_article_head_body (test.test_nntplib.NetworkedNNTP_SSLTests)
----------------------------------------------------------------------
(...)
Re-running failed tests in verbose mode
Re-running test 'test_nntplib' in verbose mode
(...)
test_article_head_body (test.test_nntplib.NetworkedNNTPTests) ... ok
BreamoreBoy commentedon Aug 1, 2014
The last five builds have been successful so can this be closed as "out of date"?
vstinner commentedon Aug 1, 2014
Really? I saw a lot of test_nntplib failures this week, on Windows buildbots for example.
vstinner commentedon Aug 1, 2014
Well, it's not exactly the same error, but it's still "sporadic failure" of test_nntp. Example:
http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/8578/steps/test/logs/stdio
======================================================================
ERROR: test_zlogin (test.test_nntplib.NetworkedNNTPTests)
----------------------------------------------------------------------
vadmium commentedon Jun 20, 2015
The timed out case seems to be similar to bpo-19756.
vadmium commentedon Jun 21, 2016
I presume the original report was due to testing when the server happened to return an article with an empty body. The failing test is
The test code already admits that what it is testing cannot be guaranteed (an article body could end with a full stop). And we have found another case where the test is not valid (an article with zero lines). I say remove this part of the test, at least when testing the article() and body() methods.
koobs commentedon Jul 27, 2016
This just failed on 3.x (default) on koobs-freebsd{9,10} bots:
======================================================================
FAIL: test_article_head_body (test.test_nntplib.NetworkedNNTP_SSLTests)
----------------------------------------------------------------------
Full log attached
vadmium commentedon Jul 27, 2016
A few other buildbots shared this failure. It would be nice to see what the article is that is causing the failure, but I’m fairly confident we should just remove this part of the test.
vadmium commentedon Jul 27, 2016
I played with the server and group that is apparently used in the test:
I tried all articles from 2900–2915, and none of them end with a dot on its own line, so I don’t actually know what caused the failure.
However looking again at the _getlongresp() implementation, I cannot imagine how the test failure can occur except for a genuine body that ends with a dot on its own line (encoded as b".." and then converted to b"."). Here is a quick patch to alter the test cases.
vadmium commentedon Jul 27, 2016
This version actually works :P
vstinner commentedon Jun 28, 2017
Sorry, I lost track of this issue. What is the status?
@martin: Do you want to convert your latest patch into a PR?
vadmium commentedon Jul 3, 2017
It looks like I was fairly confident about my patch, but it was all theoretical and I was never able to analyze the failure myself.
Sorry but I am unlikely to spend much time on this or open a pull request any time soon.
vadmium commentedon Nov 25, 2017
Victor opened bpo-32128 with the same complaint. I think I found the offending article:
The body uses Quoted-printable encoding, and the previous line ends with an equals sign “=”, meaning a soft line break. So the full stop is on its own because the encoder didn’t want to fit it on the previous line. This is valid (albeit quirky) encoding, and not a problem with the NNTP library.
vstinner commentedon Sep 19, 2018
I suggest to close the issue since the bug didn't show up recently.
berkerpeksag commentedon Sep 20, 2018
The test_article_head_body test is now skipped unconditionally:
I don't think we should close this issue without re-enabling that test.
vstinner commentedon Sep 20, 2018
The fact is that nobody cares of test_nntplib: this issue is open for 5 years. I don't see how leaving the issue open which helps. It's fine to skip a test if nobody is available to fix it.
berkerpeksag commentedon Sep 20, 2018
Well, no one is going to notice it if we close this issue. I don't see why the age of the issue matters here. We close issues when we fix them. It may take 20 minutes, 5 years or a decade.
I understand closing an issue as "out of date" when we couldn't find the root of the problem, but in this case the problem is obvious and there is already a patch that tries to fix it.
mcepl commentedon May 21, 2019
Could anybody make a PR from these patches? @vstinner, would you make me a review if I do it?
cjerdonek commentedon May 22, 2020
See also: https://bugs.python.org/issue40735 (test_with_statement)
hugovk commentedon Apr 11, 2022
I think we can close this old issue because the nntplib module is deprecated in 3.11 and set for removal in 3.13.
See PEP 594 – Removing dead batteries from the standard library and #91217.
AlexWaygood commentedon Apr 12, 2022
Cc. @mcepl, @berkerpeksag, @vadmium, @koobs
mcepl commentedon Apr 12, 2022
Well, yes, see my comment before. With a little bit of help, I would be willing to take over nntplib as a separate module. Especially if with this PR it could became less dependent on the external servers.
hugovk commentedon Apr 12, 2022
Here's some Git tips on how to grab files with history:
https://discuss.python.org/t/pep-594-take-2-removing-dead-batteries-from-the-standard-library/13508/34?u=hugovk
Used for https://pypi.org/project/legacy-cgi/ / https://github.com/jackrosenthal/python-cgi
mcepl commentedon Apr 12, 2022
I did that already when creating https://git.sr.ht/~mcepl/nntplib