New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_nntplib fails on CI #86960
Comments
Since yesterday ALL PRs are blocked by failing test_nntplib. For example https://github.com/python/cpython/runs/1629664606?check_suite_focus=true: ====================================================================== Traceback (most recent call last):
File "/home/runner/work/cpython/cpython/Lib/test/test_nntplib.py", line 250, in wrapped
meth(self)
File "/home/runner/work/cpython/cpython/Lib/test/test_nntplib.py", line 99, in test_descriptions
desc = descs[self.GROUP_NAME]
KeyError: 'comp.lang.python' ====================================================================== Traceback (most recent call last):
File "/home/runner/work/cpython/cpython/Lib/test/test_nntplib.py", line 250, in wrapped
meth(self)
File "/home/runner/work/cpython/cpython/Lib/test/test_nntplib.py", line 85, in test_description
self.assertIn("Python", desc)
AssertionError: 'Python' not found in '' |
Server is returning '215 Newsgroup descriptions in form "group description"', but an empty list of lines, so it's reaching the 'nothing' case in _getdescriptions: https://github.com/python/cpython/blob/master/Lib/nntplib.py#L660 |
Right now, it works for me: $ ./python -m test -u all test_nntplib -v -m test_descriptions
...
test_descriptions (test.test_nntplib.NNTPv1Tests) ... ok
test_descriptions (test.test_nntplib.NNTPv2Tests) ... ok
test_descriptions (test.test_nntplib.NetworkedNNTPTests) ... ok
skipped "<class 'test.test_nntplib.NetworkedNNTP_SSLTests'> got [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1122) connecting to 'nntp.aioe.org'"
...
Tests result: SUCCESS |
On my computer tests are passed. They are only failed on CI. |
FWIW, I'm getting the same errors in PR #23140 Checking on the server that's being used, the newsgroup description is empty indeed: https://news.aioe.org/index.php?id=statistics-about-groups&group=comp.lang.python |
== CPython 3.10.0a3+ (heads/master:c8a7b8fa1b, Jan 1 2021, 08:28:41) [GCC 7.5.0] ====================================================================== Traceback (most recent call last):
File "/home/corona10/cpython/Lib/test/test_nntplib.py", line 250, in wrapped
meth(self)
File "/home/corona10/cpython/Lib/test/test_nntplib.py", line 99, in test_descriptions
desc = descs[self.GROUP_NAME]
KeyError: 'comp.lang.python' Ran 4 tests in 4.734s FAILED (errors=1) == Tests result: FAILURE == 1 test failed: Total duration: 4.8 sec My test machine success to reproduce this issue. (Pdb) descs There might be 4 ways to solve this issue.
|
4 ways / 2 ways |
I submit the patch to use group_name which is mentioned from https://news.aioe.org/manual/aioe-hierarchy/ IMHO, it will be not changed frequently than what we used before. |
The test was passed on my computer because test.test_nntplib.NetworkedNNTP_SSLTests was skipped because of the configuration of SSL on Ubuntu 20.04 (see bpo-41561). After using custom openssl.cnf I get the same errors. $ OPENSSL_CONF=~/py/openssl.cnf ./python -m test -vuall test_nntplib -m 'test_description*' The NNTP server nntp.aioe.org is used instead of snews.gmane.org since 2010 (45ca987). Sadly there is no reference to any discussion, maybe Antoine remember some details. What other alternatives were considered? How to handle similar breakage of external servers? |
For tests with the external environment, The reason for testing with the outside is to confirm that the whole operation works well. Other than that, I can think of local server testing or mocking testing, but I am not sure if it is easy way for the SSL environment. |
Hmm, I change my mind this is not a good idea :( |
Does this issue mean that I should include nntplib in PEP-594 again? |
On 01.01.2021 13:57, Christian Heimes wrote:
The test fails because it was relying on an external news server's |
Broken and unstable tests are one of two reasons why I listed nntplib in my PEP, https://www.python.org/dev/peps/pep-0594/#nntplib . Q.E.D. |
Thanks for the patch, Dong-hee Na. Christian: Tests relying on external resources will always have such issues. This doesn't mean that the code which is being tested is outdated or broken. It's just an issue with the tests. Perhaps we ought to disable external tests for NNTP on CI or ask the PSF to setup a news server for testing purposes (just like we have for SSL tests), e.g. news.pythontest.net mirroring comp.lang.python. |
Thanks Dong-hee Na for the fix! We have many tests using external services, like test_ssl that Christian may know ;-) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: