Commit 80774340 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #22351. MockSslTests tests in test_nntplib now are reported if skipped.

parent 8c9bba07
...@@ -1509,15 +1509,16 @@ class MockSocketTests(unittest.TestCase): ...@@ -1509,15 +1509,16 @@ class MockSocketTests(unittest.TestCase):
Handler, nntplib.NNTPPermanentError, authinfo_response, Handler, nntplib.NNTPPermanentError, authinfo_response,
login, password) login, password)
if ssl is not None: class bypass_context:
class MockSslTests(MockSocketTests): """Bypass encryption and actual SSL module"""
class nntp_class(nntplib.NNTP_SSL): def wrap_socket(sock, **args):
def __init__(self, *pos, **kw): return sock
class bypass_context:
"""Bypass encryption and actual SSL module""" @unittest.skipUnless(ssl, 'requires SSL support')
def wrap_socket(sock, **args): class MockSslTests(MockSocketTests):
return sock @staticmethod
return super().__init__(*pos, ssl_context=bypass_context, **kw) def nntp_class(*pos, **kw):
return nntplib.NNTP_SSL(*pos, ssl_context=bypass_context, **kw)
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment