@@ -1321,10 +1321,14 @@ def test_load_verify_cadata(self):
13211321 with self .assertRaises (ssl .SSLError ):
13221322 ctx .load_verify_locations (cadata = cacert_der + b"A" )
13231323
1324- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
13251324 def test_load_dh_params (self ):
13261325 ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_SERVER )
1327- ctx .load_dh_params (DHFILE )
1326+ try :
1327+ ctx .load_dh_params (DHFILE )
1328+ except RuntimeError :
1329+ if Py_DEBUG_WIN32 :
1330+ self .skipTest ("not supported on Win32 debug build" )
1331+ raise
13281332 ctx .load_dh_params (BYTES_DHFILE )
13291333 self .assertRaises (TypeError , ctx .load_dh_params )
13301334 self .assertRaises (TypeError , ctx .load_dh_params , None )
@@ -1648,12 +1652,17 @@ def test_str(self):
16481652 self .assertEqual (str (e ), "foo" )
16491653 self .assertEqual (e .errno , 1 )
16501654
1651- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
16521655 def test_lib_reason (self ):
16531656 # Test the library and reason attributes
16541657 ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
1655- with self .assertRaises (ssl .SSLError ) as cm :
1656- ctx .load_dh_params (CERTFILE )
1658+ try :
1659+ with self .assertRaises (ssl .SSLError ) as cm :
1660+ ctx .load_dh_params (CERTFILE )
1661+ except RuntimeError :
1662+ if Py_DEBUG_WIN32 :
1663+ self .skipTest ("not supported on Win32 debug build" )
1664+ raise
1665+
16571666 self .assertEqual (cm .exception .library , 'PEM' )
16581667 regex = "(NO_START_LINE|UNSUPPORTED_PUBLIC_KEY_TYPE)"
16591668 self .assertRegex (cm .exception .reason , regex )
@@ -4032,13 +4041,17 @@ def test_no_legacy_server_connect(self):
40324041 chatty = True , connectionchatty = True ,
40334042 sni_name = hostname )
40344043
4035- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
40364044 def test_dh_params (self ):
40374045 # Check we can get a connection with ephemeral Diffie-Hellman
40384046 client_context , server_context , hostname = testing_context ()
40394047 # test scenario needs TLS <= 1.2
40404048 client_context .maximum_version = ssl .TLSVersion .TLSv1_2
4041- server_context .load_dh_params (DHFILE )
4049+ try :
4050+ server_context .load_dh_params (DHFILE )
4051+ except RuntimeError :
4052+ if Py_DEBUG_WIN32 :
4053+ self .skipTest ("not supported on Win32 debug build" )
4054+ raise
40424055 server_context .set_ciphers ("kEDH" )
40434056 server_context .maximum_version = ssl .TLSVersion .TLSv1_2
40444057 stats = server_params_test (client_context , server_context ,
@@ -4819,14 +4832,18 @@ def keylog_lines(self, fname=os_helper.TESTFN):
48194832 return len (list (f ))
48204833
48214834 @requires_keylog
4822- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
48234835 def test_keylog_defaults (self ):
48244836 self .addCleanup (os_helper .unlink , os_helper .TESTFN )
48254837 ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
48264838 self .assertEqual (ctx .keylog_filename , None )
48274839
48284840 self .assertFalse (os .path .isfile (os_helper .TESTFN ))
4829- ctx .keylog_filename = os_helper .TESTFN
4841+ try :
4842+ ctx .keylog_filename = os_helper .TESTFN
4843+ except RuntimeError :
4844+ if Py_DEBUG_WIN32 :
4845+ self .skipTest ("not supported on Win32 debug build" )
4846+ raise
48304847 self .assertEqual (ctx .keylog_filename , os_helper .TESTFN )
48314848 self .assertTrue (os .path .isfile (os_helper .TESTFN ))
48324849 self .assertEqual (self .keylog_lines (), 1 )
@@ -4843,12 +4860,17 @@ def test_keylog_defaults(self):
48434860 ctx .keylog_filename = 1
48444861
48454862 @requires_keylog
4846- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
48474863 def test_keylog_filename (self ):
48484864 self .addCleanup (os_helper .unlink , os_helper .TESTFN )
48494865 client_context , server_context , hostname = testing_context ()
48504866
4851- client_context .keylog_filename = os_helper .TESTFN
4867+ try :
4868+ client_context .keylog_filename = os_helper .TESTFN
4869+ except RuntimeError :
4870+ if Py_DEBUG_WIN32 :
4871+ self .skipTest ("not supported on Win32 debug build" )
4872+ raise
4873+
48524874 server = ThreadedEchoServer (context = server_context , chatty = False )
48534875 with server :
48544876 with client_context .wrap_socket (socket .socket (),
@@ -4881,7 +4903,6 @@ def test_keylog_filename(self):
48814903 @requires_keylog
48824904 @unittest .skipIf (sys .flags .ignore_environment ,
48834905 "test is not compatible with ignore_environment" )
4884- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
48854906 def test_keylog_env (self ):
48864907 self .addCleanup (os_helper .unlink , os_helper .TESTFN )
48874908 with unittest .mock .patch .dict (os .environ ):
@@ -4891,7 +4912,12 @@ def test_keylog_env(self):
48914912 ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
48924913 self .assertEqual (ctx .keylog_filename , None )
48934914
4894- ctx = ssl .create_default_context ()
4915+ try :
4916+ ctx = ssl .create_default_context ()
4917+ except RuntimeError :
4918+ if Py_DEBUG_WIN32 :
4919+ self .skipTest ("not supported on Win32 debug build" )
4920+ raise
48954921 self .assertEqual (ctx .keylog_filename , os_helper .TESTFN )
48964922
48974923 ctx = ssl ._create_stdlib_context ()
0 commit comments