[Python-checkins] cpython (merge 3.4 -> default): Issue #22351. MockSslTests tests in test_nntplib now are reported if skipped.

serhiy.storchaka python-checkins at python.org
Fri Apr 3 14:03:00 CEST 2015


https://hg.python.org/cpython/rev/c935c1e1d001
changeset:   95412:c935c1e1d001
parent:      95410:753233baf27e
parent:      95411:7a91363f31e1
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Apr 03 15:02:40 2015 +0300
summary:
  Issue #22351. MockSslTests tests in test_nntplib now are reported if skipped.

files:
  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
--- a/Lib/test/test_nntplib.py
+++ b/Lib/test/test_nntplib.py
@@ -1509,15 +1509,16 @@
             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
+
+ at 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__":

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list