[Python-checkins] gh-95573: Fix a mistake in asyncio ssl tests suppressing all logs (GH-95687) (GH-95699)

ambv webhook-mailer at python.org
Fri Aug 5 04:07:29 EDT 2022


https://github.com/python/cpython/commit/0e636e4e7b6bfb4c6e9b8e4b529a10302c59f62b
commit: 0e636e4e7b6bfb4c6e9b8e4b529a10302c59f62b
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2022-08-05T10:07:15+02:00
summary:

gh-95573: Fix a mistake in asyncio ssl tests suppressing all logs (GH-95687) (GH-95699)

(cherry picked from commit e1d68b3ce71de76b3d7e5852e9bdfdbb4efea2f8)

Co-authored-by: Fantix King <fantix.king at gmail.com>

files:
M Lib/test/test_asyncio/test_ssl.py

diff --git a/Lib/test/test_asyncio/test_ssl.py b/Lib/test/test_asyncio/test_ssl.py
index 5e3c1573c9c5..a2b5f8d258cd 100644
--- a/Lib/test/test_asyncio/test_ssl.py
+++ b/Lib/test/test_asyncio/test_ssl.py
@@ -58,6 +58,16 @@ def connection_lost(self, exc):
             self.done.set_result(None)
 
 
+class MessageOutFilter(logging.Filter):
+    def __init__(self, msg):
+        self.msg = msg
+
+    def filter(self, record):
+        if self.msg in record.msg:
+            return False
+        return True
+
+
 @unittest.skipIf(ssl is None, 'No ssl module')
 class TestSSL(test_utils.TestCase):
 
@@ -149,7 +159,7 @@ def _create_client_ssl_context(self, *, disable_verify=True):
     def _silence_eof_received_warning(self):
         # TODO This warning has to be fixed in asyncio.
         logger = logging.getLogger('asyncio')
-        filter = logging.Filter('has no effect when using ssl')
+        filter = MessageOutFilter('has no effect when using ssl')
         logger.addFilter(filter)
         try:
             yield



More information about the Python-checkins mailing list