Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8a257c

Browse files
committed
test_poplib: skip stls_context test when SNI is not available
1 parent cd81520 commit e8a257c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Lib/test/test_poplib.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@
2121
SUPPORTS_SSL = False
2222
if hasattr(poplib, 'POP3_SSL'):
2323
import ssl
24+
from ssl import HAS_SNI
2425

2526
SUPPORTS_SSL = True
2627
CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "keycert3.pem")
2728
CAFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "pycacert.pem")
29+
else:
30+
HAS_SNI = False
31+
2832
requires_ssl = skipUnless(SUPPORTS_SSL, 'SSL not supported')
2933

3034
# the dummy data returned by server when LIST and RETR commands are issued
@@ -330,6 +334,7 @@ def test_stls(self):
330334
self.assertEqual(resp, expected)
331335

332336
@requires_ssl
337+
@skipUnless(HAS_SNI, 'No SNI support in ssl module')
333338
def test_stls_context(self):
334339
expected = b'+OK Begin TLS negotiation'
335340
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)

0 commit comments

Comments
 (0)