classification
Title: Some test_ssl network tests fail if svn.python.org is not accessible.
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, martin.panter, vlee, vstinner
Priority: normal Keywords: easy, patch

Created on 2015-08-11 00:29 by vlee, last changed 2019-07-29 11:49 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
issue24841.diff berker.peksag, 2015-09-22 04:31 review
Messages (7)
msg248382 - (view) Author: Vinson Lee (vlee) * Date: 2015-08-11 00:29
'make test' runs all the network tests.

Some of the tests in test_ssl fail instead of skip if svn.python.org is not accessible.

$ ./python -m test -v -u all test_ssl

======================================================================
ERROR: test_non_blocking_connect_ex (test.test_ssl.NetworkedTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vinson/workspace/cpython-master/Lib/test/test_ssl.py", line 1404, in test_non_blocking_connect_ex
    s.do_handshake()
  File "Lib/ssl.py", line 978, in do_handshake
    self._check_connected()
  File "Lib/ssl.py", line 776, in _check_connected
    self.getpeername()
OSError: [Errno 107] Transport endpoint is not connected

======================================================================
FAIL: test_connect_ex (test.test_ssl.NetworkedTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_ssl.py", line 1381, in test_connect_ex
    self.assertEqual(0, s.connect_ex(("svn.python.org", 443)))
AssertionError: 0 != 111

======================================================================
FAIL: test_timeout_connect_ex (test.test_ssl.NetworkedTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_ssl.py", line 1428, in test_timeout_connect_ex
    self.assertIn(rc, (errno.EAGAIN, errno.EWOULDBLOCK))
AssertionError: 111 not found in (11, 11)

----------------------------------------------------------------------
Ran 117 tests in 3.123s

FAILED (failures=2, errors=1, skipped=20)
test test_ssl failed
1 test failed:
    test_ssl
msg251287 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-09-22 04:31
The attached patch should fix the test failures.
msg251990 - (view) Author: Vinson Lee (vlee) * Date: 2015-10-01 02:58
I tested the attached patch on latest cpython master and it works for me.

test_ciphers (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_connect (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_connect_cadata (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_connect_capath (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_connect_ex (test.test_ssl.NetworkedTests) ... skipped 'svn.python.org cannot be reached: Connection refused'
test_connect_with_context (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_context_setget (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_get_ca_certs_capath (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_get_server_certificate (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_makefile_close (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_non_blocking_connect_ex (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_non_blocking_handshake (test.test_ssl.NetworkedTests) ... skipped "Resource 'svn.python.org' is not available"
test_timeout_connect_ex (test.test_ssl.NetworkedTests) ... skipped 'svn.python.org cannot be reached: Connection refused'
test_handshake (test.test_ssl.NetworkedBIOTests) ... skipped "Resource 'svn.python.org' is not available"
test_read_write_data (test.test_ssl.NetworkedBIOTests) ... skipped "Resource 'svn.python.org' is not available"

Tested-by: Vinson Lee <vlee@twitter.com>
msg259014 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-01-27 11:17
The two changes to test_ssl.py look okay to me, although they will need updating since the Issue 24841 changeover to pythontest.net.

But I don’t think it is a good idea to add ENOTCONN to the list of errors ignored by all transient_internet() tests. In most cases, ENOTCONN suggests a programming error, not a network problem. I think a better solution would be to call connect_ex() again in test_non_blocking_connect_ex(), and retrieve the result (probably also ECONNREFUSED like the other failures, or 0 if successful).
msg259132 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-01-28 14:18
> although they will need updating since the Issue 24841 changeover to pythontest.net.

I think you meant issue 25940, right? :)

Do you want me to wait for issue 25940?
msg259161 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-01-28 21:34
Yes sorry I did mean Issue 25940 (too many bug numbers!), but only the main change which has already been made (revision adf750b1252d etc). So you don’t have to wait for that.
msg348638 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-07-29 11:49
test_ssl doesn't use svn.python.org anymore and it now better handle network failures. I close the issue as out of date.
History
Date User Action Args
2019-07-29 11:49:14vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg348638

resolution: out of date
stage: patch review -> resolved
2016-01-28 21:34:01martin.pantersetmessages: + msg259161
2016-01-28 14:18:45berker.peksagsetmessages: + msg259132
versions: - Python 3.4
2016-01-27 11:17:43martin.pantersetnosy: + martin.panter
messages: + msg259014
2015-10-01 02:58:37vleesetmessages: + msg251990
2015-09-22 04:31:37berker.peksagsetfiles: + issue24841.diff
messages: + msg251287

keywords: + patch
type: behavior
stage: needs patch -> patch review
2015-08-12 21:22:43berker.peksagsetkeywords: + easy
nosy: + berker.peksag
stage: needs patch

versions: - Python 3.3
2015-08-11 00:48:47vleesetversions: + Python 3.3, Python 3.4, Python 3.5
2015-08-11 00:29:01vleecreate