@@ -1348,10 +1348,14 @@ def test_load_verify_cadata(self):
1348
1348
with self .assertRaises (ssl .SSLError ):
1349
1349
ctx .load_verify_locations (cadata = cacert_der + b"A" )
1350
1350
1351
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
1352
1351
def test_load_dh_params (self ):
1353
1352
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_SERVER )
1354
- ctx .load_dh_params (DHFILE )
1353
+ try :
1354
+ ctx .load_dh_params (DHFILE )
1355
+ except RuntimeError :
1356
+ if Py_DEBUG_WIN32 :
1357
+ self .skipTest ("not supported on Win32 debug build" )
1358
+ raise
1355
1359
if os .name != 'nt' :
1356
1360
ctx .load_dh_params (BYTES_DHFILE )
1357
1361
self .assertRaises (TypeError , ctx .load_dh_params )
@@ -1676,12 +1680,17 @@ def test_str(self):
1676
1680
self .assertEqual (str (e ), "foo" )
1677
1681
self .assertEqual (e .errno , 1 )
1678
1682
1679
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
1680
1683
def test_lib_reason (self ):
1681
1684
# Test the library and reason attributes
1682
1685
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
1683
- with self .assertRaises (ssl .SSLError ) as cm :
1684
- ctx .load_dh_params (CERTFILE )
1686
+ try :
1687
+ with self .assertRaises (ssl .SSLError ) as cm :
1688
+ ctx .load_dh_params (CERTFILE )
1689
+ except RuntimeError :
1690
+ if Py_DEBUG_WIN32 :
1691
+ self .skipTest ("not supported on Win32 debug build" )
1692
+ raise
1693
+
1685
1694
self .assertEqual (cm .exception .library , 'PEM' )
1686
1695
regex = "(NO_START_LINE|UNSUPPORTED_PUBLIC_KEY_TYPE)"
1687
1696
self .assertRegex (cm .exception .reason , regex )
@@ -4060,13 +4069,17 @@ def test_no_legacy_server_connect(self):
4060
4069
chatty = True , connectionchatty = True ,
4061
4070
sni_name = hostname )
4062
4071
4063
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4064
4072
def test_dh_params (self ):
4065
4073
# Check we can get a connection with ephemeral Diffie-Hellman
4066
4074
client_context , server_context , hostname = testing_context ()
4067
4075
# test scenario needs TLS <= 1.2
4068
4076
client_context .maximum_version = ssl .TLSVersion .TLSv1_2
4069
- server_context .load_dh_params (DHFILE )
4077
+ try :
4078
+ server_context .load_dh_params (DHFILE )
4079
+ except RuntimeError :
4080
+ if Py_DEBUG_WIN32 :
4081
+ self .skipTest ("not supported on Win32 debug build" )
4082
+ raise
4070
4083
server_context .set_ciphers ("kEDH" )
4071
4084
server_context .maximum_version = ssl .TLSVersion .TLSv1_2
4072
4085
stats = server_params_test (client_context , server_context ,
@@ -4846,14 +4859,18 @@ def keylog_lines(self, fname=os_helper.TESTFN):
4846
4859
return len (list (f ))
4847
4860
4848
4861
@requires_keylog
4849
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4850
4862
def test_keylog_defaults (self ):
4851
4863
self .addCleanup (os_helper .unlink , os_helper .TESTFN )
4852
4864
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
4853
4865
self .assertEqual (ctx .keylog_filename , None )
4854
4866
4855
4867
self .assertFalse (os .path .isfile (os_helper .TESTFN ))
4856
- ctx .keylog_filename = os_helper .TESTFN
4868
+ try :
4869
+ ctx .keylog_filename = os_helper .TESTFN
4870
+ except RuntimeError :
4871
+ if Py_DEBUG_WIN32 :
4872
+ self .skipTest ("not supported on Win32 debug build" )
4873
+ raise
4857
4874
self .assertEqual (ctx .keylog_filename , os_helper .TESTFN )
4858
4875
self .assertTrue (os .path .isfile (os_helper .TESTFN ))
4859
4876
self .assertEqual (self .keylog_lines (), 1 )
@@ -4870,12 +4887,17 @@ def test_keylog_defaults(self):
4870
4887
ctx .keylog_filename = 1
4871
4888
4872
4889
@requires_keylog
4873
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4874
4890
def test_keylog_filename (self ):
4875
4891
self .addCleanup (os_helper .unlink , os_helper .TESTFN )
4876
4892
client_context , server_context , hostname = testing_context ()
4877
4893
4878
- client_context .keylog_filename = os_helper .TESTFN
4894
+ try :
4895
+ client_context .keylog_filename = os_helper .TESTFN
4896
+ except RuntimeError :
4897
+ if Py_DEBUG_WIN32 :
4898
+ self .skipTest ("not supported on Win32 debug build" )
4899
+ raise
4900
+
4879
4901
server = ThreadedEchoServer (context = server_context , chatty = False )
4880
4902
with server :
4881
4903
with client_context .wrap_socket (socket .socket (),
@@ -4908,7 +4930,6 @@ def test_keylog_filename(self):
4908
4930
@requires_keylog
4909
4931
@unittest .skipIf (sys .flags .ignore_environment ,
4910
4932
"test is not compatible with ignore_environment" )
4911
- @unittest .skipIf (Py_DEBUG_WIN32 , "Avoid mixing debug/release CRT on Windows" )
4912
4933
def test_keylog_env (self ):
4913
4934
self .addCleanup (os_helper .unlink , os_helper .TESTFN )
4914
4935
with unittest .mock .patch .dict (os .environ ):
@@ -4918,7 +4939,12 @@ def test_keylog_env(self):
4918
4939
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
4919
4940
self .assertEqual (ctx .keylog_filename , None )
4920
4941
4921
- ctx = ssl .create_default_context ()
4942
+ try :
4943
+ ctx = ssl .create_default_context ()
4944
+ except RuntimeError :
4945
+ if Py_DEBUG_WIN32 :
4946
+ self .skipTest ("not supported on Win32 debug build" )
4947
+ raise
4922
4948
self .assertEqual (ctx .keylog_filename , os_helper .TESTFN )
4923
4949
4924
4950
ctx = ssl ._create_stdlib_context ()
0 commit comments