Skip to content

gh-95573: Fix a mistake in asyncio ssl test suppressing all logs #95687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Lib/test/test_asyncio/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down Expand Up @@ -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
Expand Down