@@ -5121,15 +5121,27 @@ def non_linux_skip_if_other_okay_error(self, err):
51215121 return # Expect the full test setup to always work on Linux.
51225122 if (isinstance (err , ConnectionResetError ) or
51235123 (isinstance (err , OSError ) and err .errno == errno .EINVAL ) or
5124- re .search ('wrong.version.number' , getattr (err , "reason" , "" ), re .I )):
5124+ re .search (
5125+ # Matches the following error messages:
5126+ # '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'
5127+ # '[SSL: RECORD_LAYER_FAILURE] record layer failure (_ssl.c:1109)'
5128+ # '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'
5129+ r'wrong.version.number|record.layer.failure|http.request' ,
5130+ str (getattr (err , "reason" , "" )),
5131+ re .IGNORECASE ,
5132+ )
5133+ ):
51255134 # On Windows the TCP RST leads to a ConnectionResetError
51265135 # (ECONNRESET) which Linux doesn't appear to surface to userspace.
51275136 # If wrap_socket() winds up on the "if connected:" path and doing
5128- # the actual wrapping... we get an SSLError from OpenSSL. Typically
5129- # WRONG_VERSION_NUMBER. While appropriate, neither is the scenario
5130- # we're specifically trying to test. The way this test is written
5131- # is known to work on Linux. We'll skip it anywhere else that it
5132- # does not present as doing so.
5137+ # the actual wrapping... we get an SSLError from OpenSSL. This is
5138+ # typically WRONG_VERSION_NUMBER. The same happens on iOS, but
5139+ # RECORD_LAYER_FAILURE or HTTP_REQUEST is the error.
5140+ #
5141+ # While appropriate, these scenarios aren't what we're specifically
5142+ # trying to test. The way this test is written is known to work on
5143+ # Linux. We'll skip it anywhere else that it does not present as
5144+ # doing so.
51335145 try :
51345146 self .skipTest (f"Could not recreate conditions on { sys .platform } :"
51355147 f" { err = } " )
0 commit comments