@@ -5069,15 +5069,27 @@ def non_linux_skip_if_other_okay_error(self, err):
50695069 return # Expect the full test setup to always work on Linux.
50705070 if (isinstance (err , ConnectionResetError ) or
50715071 (isinstance (err , OSError ) and err .errno == errno .EINVAL ) or
5072- re .search ('wrong.version.number' , getattr (err , "reason" , "" ), re .I )):
5072+ re .search (
5073+ # Matches the following error messages:
5074+ # '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'
5075+ # '[SSL: RECORD_LAYER_FAILURE] record layer failure (_ssl.c:1109)'
5076+ # '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'
5077+ r'wrong.version.number|record.layer.failure|http.request' ,
5078+ str (getattr (err , "reason" , "" )),
5079+ re .IGNORECASE ,
5080+ )
5081+ ):
50735082 # On Windows the TCP RST leads to a ConnectionResetError
50745083 # (ECONNRESET) which Linux doesn't appear to surface to userspace.
50755084 # If wrap_socket() winds up on the "if connected:" path and doing
5076- # the actual wrapping... we get an SSLError from OpenSSL. Typically
5077- # WRONG_VERSION_NUMBER. While appropriate, neither is the scenario
5078- # we're specifically trying to test. The way this test is written
5079- # is known to work on Linux. We'll skip it anywhere else that it
5080- # does not present as doing so.
5085+ # the actual wrapping... we get an SSLError from OpenSSL. This is
5086+ # typically WRONG_VERSION_NUMBER. The same happens on iOS, but
5087+ # RECORD_LAYER_FAILURE or HTTP_REQUEST is the error.
5088+ #
5089+ # While appropriate, these scenarios aren't what we're specifically
5090+ # trying to test. The way this test is written is known to work on
5091+ # Linux. We'll skip it anywhere else that it does not present as
5092+ # doing so.
50815093 try :
50825094 self .skipTest (f"Could not recreate conditions on { sys .platform } :"
50835095 f" { err = } " )
0 commit comments