@@ -610,6 +610,8 @@ def test_openssl111_deprecations(self):
610
610
)
611
611
612
612
for protocol in protocols :
613
+ if not has_tls_protocol (protocol ):
614
+ continue
613
615
with self .subTest (protocol = protocol ):
614
616
with self .assertWarns (DeprecationWarning ) as cm :
615
617
ssl .SSLContext (protocol )
@@ -619,6 +621,8 @@ def test_openssl111_deprecations(self):
619
621
)
620
622
621
623
for version in versions :
624
+ if not has_tls_version (version ):
625
+ continue
622
626
with self .subTest (version = version ):
623
627
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_CLIENT )
624
628
with self .assertWarns (DeprecationWarning ) as cm :
@@ -934,9 +938,10 @@ class ContextTests(unittest.TestCase):
934
938
935
939
def test_constructor (self ):
936
940
for protocol in PROTOCOLS :
937
- with warnings_helper .check_warnings ():
938
- ctx = ssl .SSLContext (protocol )
939
- self .assertEqual (ctx .protocol , protocol )
941
+ if has_tls_protocol (protocol ):
942
+ with warnings_helper .check_warnings ():
943
+ ctx = ssl .SSLContext (protocol )
944
+ self .assertEqual (ctx .protocol , protocol )
940
945
with warnings_helper .check_warnings ():
941
946
ctx = ssl .SSLContext ()
942
947
self .assertEqual (ctx .protocol , ssl .PROTOCOL_TLS )
@@ -1502,20 +1507,19 @@ def test_create_default_context(self):
1502
1507
self .assertEqual (ctx .verify_mode , ssl .CERT_NONE )
1503
1508
self ._assert_context_options (ctx )
1504
1509
1505
-
1506
-
1507
1510
def test__create_stdlib_context (self ):
1508
1511
ctx = ssl ._create_stdlib_context ()
1509
1512
self .assertEqual (ctx .protocol , ssl .PROTOCOL_TLS_CLIENT )
1510
1513
self .assertEqual (ctx .verify_mode , ssl .CERT_NONE )
1511
1514
self .assertFalse (ctx .check_hostname )
1512
1515
self ._assert_context_options (ctx )
1513
1516
1514
- with warnings_helper .check_warnings ():
1515
- ctx = ssl ._create_stdlib_context (ssl .PROTOCOL_TLSv1 )
1516
- self .assertEqual (ctx .protocol , ssl .PROTOCOL_TLSv1 )
1517
- self .assertEqual (ctx .verify_mode , ssl .CERT_NONE )
1518
- self ._assert_context_options (ctx )
1517
+ if has_tls_protocol (ssl .PROTOCOL_TLSv1 ):
1518
+ with warnings_helper .check_warnings ():
1519
+ ctx = ssl ._create_stdlib_context (ssl .PROTOCOL_TLSv1 )
1520
+ self .assertEqual (ctx .protocol , ssl .PROTOCOL_TLSv1 )
1521
+ self .assertEqual (ctx .verify_mode , ssl .CERT_NONE )
1522
+ self ._assert_context_options (ctx )
1519
1523
1520
1524
with warnings_helper .check_warnings ():
1521
1525
ctx = ssl ._create_stdlib_context (
0 commit comments