@@ -1326,10 +1326,14 @@ def test_load_verify_cadata(self):
13261326 with self .assertRaises (ssl .SSLError ):
13271327 ctx .load_verify_locations (cadata = cacert_der + b"A" )
13281328
1329- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
13301329 def test_load_dh_params (self ):
13311330 ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_SERVER )
1332- ctx .load_dh_params (DHFILE )
1331+ try :
1332+ ctx .load_dh_params (DHFILE )
1333+ except RuntimeError :
1334+ if Py_DEBUG_WIN32 :
1335+ self .skipTest ("not supported on Win32 debug build" )
1336+ raise
13331337 if os .name != 'nt' :
13341338 ctx .load_dh_params (BYTES_DHFILE )
13351339 self .assertRaises (TypeError , ctx .load_dh_params )
@@ -1650,12 +1654,17 @@ def test_str(self):
16501654 self .assertEqual (str (e ), "foo" )
16511655 self .assertEqual (e .errno , 1 )
16521656
1653- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
16541657 def test_lib_reason (self ):
16551658 # Test the library and reason attributes
16561659 ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
1657- with self .assertRaises (ssl .SSLError ) as cm :
1658- ctx .load_dh_params (CERTFILE )
1660+ try :
1661+ with self .assertRaises (ssl .SSLError ) as cm :
1662+ ctx .load_dh_params (CERTFILE )
1663+ except RuntimeError :
1664+ if Py_DEBUG_WIN32 :
1665+ self .skipTest ("not supported on Win32 debug build" )
1666+ raise
1667+
16591668 self .assertEqual (cm .exception .library , 'PEM' )
16601669 regex = "(NO_START_LINE|UNSUPPORTED_PUBLIC_KEY_TYPE)"
16611670 self .assertRegex (cm .exception .reason , regex )
@@ -3960,13 +3969,17 @@ def test_no_legacy_server_connect(self):
39603969 chatty = True , connectionchatty = True ,
39613970 sni_name = hostname )
39623971
3963- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
39643972 def test_dh_params (self ):
39653973 # Check we can get a connection with ephemeral Diffie-Hellman
39663974 client_context , server_context , hostname = testing_context ()
39673975 # test scenario needs TLS <= 1.2
39683976 client_context .maximum_version = ssl .TLSVersion .TLSv1_2
3969- server_context .load_dh_params (DHFILE )
3977+ try :
3978+ server_context .load_dh_params (DHFILE )
3979+ except RuntimeError :
3980+ if Py_DEBUG_WIN32 :
3981+ self .skipTest ("not supported on Win32 debug build" )
3982+ raise
39703983 server_context .set_ciphers ("kEDH" )
39713984 server_context .maximum_version = ssl .TLSVersion .TLSv1_2
39723985 stats = server_params_test (client_context , server_context ,
@@ -4607,14 +4620,18 @@ def keylog_lines(self, fname=os_helper.TESTFN):
46074620 return len (list (f ))
46084621
46094622 @requires_keylog
4610- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
46114623 def test_keylog_defaults (self ):
46124624 self .addCleanup (os_helper .unlink , os_helper .TESTFN )
46134625 ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
46144626 self .assertEqual (ctx .keylog_filename , None )
46154627
46164628 self .assertFalse (os .path .isfile (os_helper .TESTFN ))
4617- ctx .keylog_filename = os_helper .TESTFN
4629+ try :
4630+ ctx .keylog_filename = os_helper .TESTFN
4631+ except RuntimeError :
4632+ if Py_DEBUG_WIN32 :
4633+ self .skipTest ("not supported on Win32 debug build" )
4634+ raise
46184635 self .assertEqual (ctx .keylog_filename , os_helper .TESTFN )
46194636 self .assertTrue (os .path .isfile (os_helper .TESTFN ))
46204637 self .assertEqual (self .keylog_lines (), 1 )
@@ -4631,12 +4648,17 @@ def test_keylog_defaults(self):
46314648 ctx .keylog_filename = 1
46324649
46334650 @requires_keylog
4634- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
46354651 def test_keylog_filename (self ):
46364652 self .addCleanup (os_helper .unlink , os_helper .TESTFN )
46374653 client_context , server_context , hostname = testing_context ()
46384654
4639- client_context .keylog_filename = os_helper .TESTFN
4655+ try :
4656+ client_context .keylog_filename = os_helper .TESTFN
4657+ except RuntimeError :
4658+ if Py_DEBUG_WIN32 :
4659+ self .skipTest ("not supported on Win32 debug build" )
4660+ raise
4661+
46404662 server = ThreadedEchoServer (context = server_context , chatty = False )
46414663 with server :
46424664 with client_context .wrap_socket (socket .socket (),
@@ -4669,7 +4691,6 @@ def test_keylog_filename(self):
46694691 @requires_keylog
46704692 @unittest .skipIf (sys .flags .ignore_environment ,
46714693 "test is not compatible with ignore_environment" )
4672- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
46734694 def test_keylog_env (self ):
46744695 self .addCleanup (os_helper .unlink , os_helper .TESTFN )
46754696 with unittest .mock .patch .dict (os .environ ):
@@ -4679,7 +4700,12 @@ def test_keylog_env(self):
46794700 ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
46804701 self .assertEqual (ctx .keylog_filename , None )
46814702
4682- ctx = ssl .create_default_context ()
4703+ try :
4704+ ctx = ssl .create_default_context ()
4705+ except RuntimeError :
4706+ if Py_DEBUG_WIN32 :
4707+ self .skipTest ("not supported on Win32 debug build" )
4708+ raise
46834709 self .assertEqual (ctx .keylog_filename , os_helper .TESTFN )
46844710
46854711 ctx = ssl ._create_stdlib_context ()
0 commit comments