Commit 8c9bba07 authored by Victor Stinner's avatar Victor Stinner

Issue #22351: Fix test_nntplib if the ssl module is missing

@unittest.skipUnless(ssl, '...') doesn't work because the class body uses the
nntplib.NNTP_SSL attribute which doesn't exist.
parent 13e41c51
......@@ -1509,8 +1509,8 @@ class MockSocketTests(unittest.TestCase):
Handler, nntplib.NNTPPermanentError, authinfo_response,
login, password)
@unittest.skipUnless(ssl, 'requires SSL support')
class MockSslTests(MockSocketTests):
if ssl is not None:
class MockSslTests(MockSocketTests):
class nntp_class(nntplib.NNTP_SSL):
def __init__(self, *pos, **kw):
class bypass_context:
......@@ -1519,5 +1519,6 @@ class MockSslTests(MockSocketTests):
return sock
return super().__init__(*pos, ssl_context=bypass_context, **kw)
if __name__ == "__main__":
unittest.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