Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8077434

Browse files
Issue #22351. MockSslTests tests in test_nntplib now are reported if skipped.
1 parent 8c9bba0 commit 8077434

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

Lib/test/test_nntplib.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,15 +1509,16 @@ def handle_AUTHINFO(self, *args):
15091509
Handler, nntplib.NNTPPermanentError, authinfo_response,
15101510
login, password)
15111511

1512-
if ssl is not None:
1513-
class MockSslTests(MockSocketTests):
1514-
class nntp_class(nntplib.NNTP_SSL):
1515-
def __init__(self, *pos, **kw):
1516-
class bypass_context:
1517-
"""Bypass encryption and actual SSL module"""
1518-
def wrap_socket(sock, **args):
1519-
return sock
1520-
return super().__init__(*pos, ssl_context=bypass_context, **kw)
1512+
class bypass_context:
1513+
"""Bypass encryption and actual SSL module"""
1514+
def wrap_socket(sock, **args):
1515+
return sock
1516+
1517+
@unittest.skipUnless(ssl, 'requires SSL support')
1518+
class MockSslTests(MockSocketTests):
1519+
@staticmethod
1520+
def nntp_class(*pos, **kw):
1521+
return nntplib.NNTP_SSL(*pos, ssl_context=bypass_context, **kw)
15211522

15221523

15231524
if __name__ == "__main__":

0 commit comments

Comments
 (0)