mirror of https://github.com/python/cpython
Issue #22351. MockSslTests tests in test_nntplib now are reported if skipped.
This commit is contained in:
commit
4deb950e2b
|
@ -1509,15 +1509,16 @@ class MockSocketTests(unittest.TestCase):
|
|||
Handler, nntplib.NNTPPermanentError, authinfo_response,
|
||||
login, password)
|
||||
|
||||
if ssl is not None:
|
||||
class MockSslTests(MockSocketTests):
|
||||
class nntp_class(nntplib.NNTP_SSL):
|
||||
def __init__(self, *pos, **kw):
|
||||
class bypass_context:
|
||||
"""Bypass encryption and actual SSL module"""
|
||||
def wrap_socket(sock, **args):
|
||||
return sock
|
||||
return super().__init__(*pos, ssl_context=bypass_context, **kw)
|
||||
class bypass_context:
|
||||
"""Bypass encryption and actual SSL module"""
|
||||
def wrap_socket(sock, **args):
|
||||
return sock
|
||||
|
||||
@unittest.skipUnless(ssl, 'requires SSL support')
|
||||
class MockSslTests(MockSocketTests):
|
||||
@staticmethod
|
||||
def nntp_class(*pos, **kw):
|
||||
return nntplib.NNTP_SSL(*pos, ssl_context=bypass_context, **kw)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue