test_ftplib: skip check_hostname test when SNI is not available

This commit is contained in:
Christian Heimes 2013-12-15 19:38:22 +01:00
parent a5f0eda91a
commit e7945d76ff
1 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,9 @@ try:
import ssl
except ImportError:
ssl = None
HAS_SNI = False
else:
from ssl import HAS_SNI
from unittest import TestCase, skipUnless
from test import support
@ -924,6 +927,7 @@ class TestTLS_FTPClass(TestCase):
self.client.ccc()
self.assertRaises(ValueError, self.client.sock.unwrap)
@unittest.skipUnless(HAS_SNI, 'No SNI support in ssl module')
def test_check_hostname(self):
self.client.quit()
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)