]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
test_poplib: skip stls_context test when SNI is not available
authorChristian Heimes <christian@cheimes.de>
Sun, 15 Dec 2013 20:44:43 +0000 (21:44 +0100)
committerChristian Heimes <christian@cheimes.de>
Sun, 15 Dec 2013 20:44:43 +0000 (21:44 +0100)
Lib/test/test_poplib.py

index eac77aa6ffe2a6d3a19a5fc543ab53afb6786574..aced2080a4c67baa7e1b19d6e8068a52c2fe1103 100644 (file)
@@ -21,10 +21,14 @@ PORT = 0
 SUPPORTS_SSL = False
 if hasattr(poplib, 'POP3_SSL'):
     import ssl
+    from ssl import HAS_SNI
 
     SUPPORTS_SSL = True
     CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "keycert3.pem")
     CAFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "pycacert.pem")
+else:
+    HAS_SNI = False
+
 requires_ssl = skipUnless(SUPPORTS_SSL, 'SSL not supported')
 
 # the dummy data returned by server when LIST and RETR commands are issued
@@ -330,6 +334,7 @@ class TestPOP3Class(TestCase):
         self.assertEqual(resp, expected)
 
     @requires_ssl
+    @skipUnless(HAS_SNI, 'No SNI support in ssl module')
     def test_stls_context(self):
         expected = b'+OK Begin TLS negotiation'
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)