diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-03 12:02:20 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-03 12:02:20 (GMT) |
commit | 807743403d08cfbadfbb304832465b01fb3cf033 (patch) | |
tree | 4a753e80e1d176ca1bc5da093a8d94eca7b38c90 | |
parent | 8c9bba07d40f8a86bfa0dc87a4c06f91a07676a6 (diff) | |
download | cpython-807743403d08cfbadfbb304832465b01fb3cf033.zip cpython-807743403d08cfbadfbb304832465b01fb3cf033.tar.gz cpython-807743403d08cfbadfbb304832465b01fb3cf033.tar.bz2 |
Issue #22351. MockSslTests tests in test_nntplib now are reported if skipped.
-rw-r--r-- | Lib/test/test_nntplib.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py index 9a80674..ae3618f 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__": |