@@ -1321,10 +1321,14 @@ def test_load_verify_cadata(self):
1321
1321
with self .assertRaises (ssl .SSLError ):
1322
1322
ctx .load_verify_locations (cadata = cacert_der + b"A" )
1323
1323
1324
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
1325
1324
def test_load_dh_params (self ):
1326
1325
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
1328
1332
ctx .load_dh_params (BYTES_DHFILE )
1329
1333
self .assertRaises (TypeError , ctx .load_dh_params )
1330
1334
self .assertRaises (TypeError , ctx .load_dh_params , None )
@@ -1648,12 +1652,17 @@ def test_str(self):
1648
1652
self .assertEqual (str (e ), "foo" )
1649
1653
self .assertEqual (e .errno , 1 )
1650
1654
1651
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
1652
1655
def test_lib_reason (self ):
1653
1656
# Test the library and reason attributes
1654
1657
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
+
1657
1666
self .assertEqual (cm .exception .library , 'PEM' )
1658
1667
regex = "(NO_START_LINE|UNSUPPORTED_PUBLIC_KEY_TYPE)"
1659
1668
self .assertRegex (cm .exception .reason , regex )
@@ -4032,13 +4041,17 @@ def test_no_legacy_server_connect(self):
4032
4041
chatty = True , connectionchatty = True ,
4033
4042
sni_name = hostname )
4034
4043
4035
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4036
4044
def test_dh_params (self ):
4037
4045
# Check we can get a connection with ephemeral Diffie-Hellman
4038
4046
client_context , server_context , hostname = testing_context ()
4039
4047
# test scenario needs TLS <= 1.2
4040
4048
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
4042
4055
server_context .set_ciphers ("kEDH" )
4043
4056
server_context .maximum_version = ssl .TLSVersion .TLSv1_2
4044
4057
stats = server_params_test (client_context , server_context ,
@@ -4819,14 +4832,18 @@ def keylog_lines(self, fname=os_helper.TESTFN):
4819
4832
return len (list (f ))
4820
4833
4821
4834
@requires_keylog
4822
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4823
4835
def test_keylog_defaults (self ):
4824
4836
self .addCleanup (os_helper .unlink , os_helper .TESTFN )
4825
4837
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
4826
4838
self .assertEqual (ctx .keylog_filename , None )
4827
4839
4828
4840
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
4830
4847
self .assertEqual (ctx .keylog_filename , os_helper .TESTFN )
4831
4848
self .assertTrue (os .path .isfile (os_helper .TESTFN ))
4832
4849
self .assertEqual (self .keylog_lines (), 1 )
@@ -4843,12 +4860,17 @@ def test_keylog_defaults(self):
4843
4860
ctx .keylog_filename = 1
4844
4861
4845
4862
@requires_keylog
4846
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4847
4863
def test_keylog_filename (self ):
4848
4864
self .addCleanup (os_helper .unlink , os_helper .TESTFN )
4849
4865
client_context , server_context , hostname = testing_context ()
4850
4866
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
+
4852
4874
server = ThreadedEchoServer (context = server_context , chatty = False )
4853
4875
with server :
4854
4876
with client_context .wrap_socket (socket .socket (),
@@ -4881,7 +4903,6 @@ def test_keylog_filename(self):
4881
4903
@requires_keylog
4882
4904
@unittest .skipIf (sys .flags .ignore_environment ,
4883
4905
"test is not compatible with ignore_environment" )
4884
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4885
4906
def test_keylog_env (self ):
4886
4907
self .addCleanup (os_helper .unlink , os_helper .TESTFN )
4887
4908
with unittest .mock .patch .dict (os .environ ):
@@ -4891,7 +4912,12 @@ def test_keylog_env(self):
4891
4912
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
4892
4913
self .assertEqual (ctx .keylog_filename , None )
4893
4914
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
4895
4921
self .assertEqual (ctx .keylog_filename , os_helper .TESTFN )
4896
4922
4897
4923
ctx = ssl ._create_stdlib_context ()
0 commit comments