@@ -1326,10 +1326,14 @@ def test_load_verify_cadata(self):
1326
1326
with self .assertRaises (ssl .SSLError ):
1327
1327
ctx .load_verify_locations (cadata = cacert_der + b"A" )
1328
1328
1329
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
1330
1329
def test_load_dh_params (self ):
1331
1330
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
1333
1337
if os .name != 'nt' :
1334
1338
ctx .load_dh_params (BYTES_DHFILE )
1335
1339
self .assertRaises (TypeError , ctx .load_dh_params )
@@ -1650,12 +1654,17 @@ def test_str(self):
1650
1654
self .assertEqual (str (e ), "foo" )
1651
1655
self .assertEqual (e .errno , 1 )
1652
1656
1653
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
1654
1657
def test_lib_reason (self ):
1655
1658
# Test the library and reason attributes
1656
1659
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
+
1659
1668
self .assertEqual (cm .exception .library , 'PEM' )
1660
1669
regex = "(NO_START_LINE|UNSUPPORTED_PUBLIC_KEY_TYPE)"
1661
1670
self .assertRegex (cm .exception .reason , regex )
@@ -3960,13 +3969,17 @@ def test_no_legacy_server_connect(self):
3960
3969
chatty = True , connectionchatty = True ,
3961
3970
sni_name = hostname )
3962
3971
3963
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
3964
3972
def test_dh_params (self ):
3965
3973
# Check we can get a connection with ephemeral Diffie-Hellman
3966
3974
client_context , server_context , hostname = testing_context ()
3967
3975
# test scenario needs TLS <= 1.2
3968
3976
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
3970
3983
server_context .set_ciphers ("kEDH" )
3971
3984
server_context .maximum_version = ssl .TLSVersion .TLSv1_2
3972
3985
stats = server_params_test (client_context , server_context ,
@@ -4607,14 +4620,18 @@ def keylog_lines(self, fname=os_helper.TESTFN):
4607
4620
return len (list (f ))
4608
4621
4609
4622
@requires_keylog
4610
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4611
4623
def test_keylog_defaults (self ):
4612
4624
self .addCleanup (os_helper .unlink , os_helper .TESTFN )
4613
4625
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
4614
4626
self .assertEqual (ctx .keylog_filename , None )
4615
4627
4616
4628
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
4618
4635
self .assertEqual (ctx .keylog_filename , os_helper .TESTFN )
4619
4636
self .assertTrue (os .path .isfile (os_helper .TESTFN ))
4620
4637
self .assertEqual (self .keylog_lines (), 1 )
@@ -4631,12 +4648,17 @@ def test_keylog_defaults(self):
4631
4648
ctx .keylog_filename = 1
4632
4649
4633
4650
@requires_keylog
4634
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4635
4651
def test_keylog_filename (self ):
4636
4652
self .addCleanup (os_helper .unlink , os_helper .TESTFN )
4637
4653
client_context , server_context , hostname = testing_context ()
4638
4654
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
+
4640
4662
server = ThreadedEchoServer (context = server_context , chatty = False )
4641
4663
with server :
4642
4664
with client_context .wrap_socket (socket .socket (),
@@ -4669,7 +4691,6 @@ def test_keylog_filename(self):
4669
4691
@requires_keylog
4670
4692
@unittest .skipIf (sys .flags .ignore_environment ,
4671
4693
"test is not compatible with ignore_environment" )
4672
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4673
4694
def test_keylog_env (self ):
4674
4695
self .addCleanup (os_helper .unlink , os_helper .TESTFN )
4675
4696
with unittest .mock .patch .dict (os .environ ):
@@ -4679,7 +4700,12 @@ def test_keylog_env(self):
4679
4700
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
4680
4701
self .assertEqual (ctx .keylog_filename , None )
4681
4702
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
4683
4709
self .assertEqual (ctx .keylog_filename , os_helper .TESTFN )
4684
4710
4685
4711
ctx = ssl ._create_stdlib_context ()
0 commit comments