From 807743403d08cfbadfbb304832465b01fb3cf033 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 3 Apr 2015 15:02:20 +0300 Subject: Issue #22351. MockSslTests tests in test_nntplib now are reported if skipped. --- Lib/test/test_nntplib.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'Lib/test/test_nntplib.py') diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py index 9a8067434c..ae3618ffbc 100644 --- a/Lib/test/test_nntplib.py +++ b/Lib/test/test_nntplib.py @@ -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__": -- cgit v1.2.1