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

(cherry picked from commit e1d68b3ce7)

Co-authored-by: Fantix King <fantix.king@gmail.com>
This commit is contained in:
Miss Islington (bot) 2022-08-05 01:07:15 -07:00 committed by GitHub
parent 82328126b4
commit 0e636e4e7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,6 +58,16 @@ class MyBaseProto(asyncio.Protocol):
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 @@ class TestSSL(test_utils.TestCase):
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