@@ -1141,8 +1141,10 @@ def test_constructor(self):
1141
1141
1142
1142
def test_protocol (self ):
1143
1143
for proto in PROTOCOLS :
1144
- ctx = ssl .SSLContext (proto )
1145
- self .assertEqual (ctx .protocol , proto )
1144
+ if has_tls_protocol (proto ):
1145
+ with warnings_helper .check_warnings ():
1146
+ ctx = ssl .SSLContext (proto )
1147
+ self .assertEqual (ctx .protocol , proto )
1146
1148
1147
1149
def test_ciphers (self ):
1148
1150
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
@@ -1524,7 +1526,10 @@ def test_load_dh_params(self):
1524
1526
1525
1527
def test_session_stats (self ):
1526
1528
for proto in PROTOCOLS :
1527
- ctx = ssl .SSLContext (proto )
1529
+ if not has_tls_protocol (proto ):
1530
+ continue
1531
+ with warnings_helper .check_warnings ():
1532
+ ctx = ssl .SSLContext (proto )
1528
1533
self .assertEqual (ctx .session_stats (), {
1529
1534
'number' : 0 ,
1530
1535
'connect' : 0 ,
@@ -1715,13 +1720,14 @@ def test__create_stdlib_context(self):
1715
1720
self .assertEqual (ctx .verify_mode , ssl .CERT_NONE )
1716
1721
self ._assert_context_options (ctx )
1717
1722
1718
- ctx = ssl ._create_stdlib_context (ssl .PROTOCOL_TLSv1 ,
1719
- cert_reqs = ssl .CERT_REQUIRED ,
1720
- check_hostname = True )
1721
- self .assertEqual (ctx .protocol , ssl .PROTOCOL_TLSv1 )
1722
- self .assertEqual (ctx .verify_mode , ssl .CERT_REQUIRED )
1723
- self .assertTrue (ctx .check_hostname )
1724
- self ._assert_context_options (ctx )
1723
+ with warnings_helper .check_warnings ():
1724
+ ctx = ssl ._create_stdlib_context (ssl .PROTOCOL_TLSv1 ,
1725
+ cert_reqs = ssl .CERT_REQUIRED ,
1726
+ check_hostname = True )
1727
+ self .assertEqual (ctx .protocol , ssl .PROTOCOL_TLSv1 )
1728
+ self .assertEqual (ctx .verify_mode , ssl .CERT_REQUIRED )
1729
+ self .assertTrue (ctx .check_hostname )
1730
+ self ._assert_context_options (ctx )
1725
1731
1726
1732
ctx = ssl ._create_stdlib_context (purpose = ssl .Purpose .CLIENT_AUTH )
1727
1733
self .assertEqual (ctx .protocol , ssl .PROTOCOL_TLS )
0 commit comments