[issue44229] test_get_server_certificate fails intermittently on macOS

Erlend E. Aasland report at bugs.python.org
Tue May 25 09:41:51 EDT 2021


Erlend E. Aasland <erlend.aasland at innova.no> added the comment:

$ git diff
diff --git a/Lib/ssl.py b/Lib/ssl.py
index 2b131de043..9c281d8028 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -257,8 +257,9 @@ class _TLSMessageType:
 if sys.platform == "win32":
     from _ssl import enum_certificates, enum_crls
 
+from test.support import SHORT_TIMEOUT as _GLOBAL_DEFAULT_TIMEOUT
 from socket import socket, SOCK_STREAM, create_connection
-from socket import SOL_SOCKET, SO_TYPE, _GLOBAL_DEFAULT_TIMEOUT
+from socket import SOL_SOCKET, SO_TYPE
 import socket as _socket
 import base64        # for DER-to-PEM translation
 import errno

$ % ./python.exe -m test test_ssl -m test_get_server_certificate -u all -F
...
0:03:27 load avg: 2.24 [535] test_ssl
test test_ssl failed -- Traceback (most recent call last):
  File "/Users/erlendaasland/src/cpython-ssl/Lib/test/test_ssl.py", line 2132, in test_get_server_certificate
    _test_get_server_certificate(self, *self.server_addr, cert=SIGNING_CA)
  File "/Users/erlendaasland/src/cpython-ssl/Lib/test/test_ssl.py", line 2329, in _test_get_server_certificate
    pem = ssl.get_server_certificate((host, port), ca_certs=cert)
  File "/Users/erlendaasland/src/cpython-ssl/Lib/ssl.py", line 1521, in get_server_certificate
    with create_connection(addr, timeout=timeout) as sock:
  File "/Users/erlendaasland/src/cpython-ssl/Lib/socket.py", line 844, in create_connection
    raise err
  File "/Users/erlendaasland/src/cpython-ssl/Lib/socket.py", line 832, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

test_ssl failed

== Tests result: FAILURE ==

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44229>
_______________________________________


More information about the Python-bugs-list mailing list