F [100%] =================================== FAILURES =================================== ______ test_server_disconnect_error_is_not_logged_as_application_failure _______ async def test_server_disconnect_error_is_not_logged_as_application_failure(): started, finished = asyncio.Event(), asyncio.Event() reports = [] async def app(scope, receive, send): await receive() started.set() try: assert (await receive())['type'] == 'http.disconnect' await reply(send) finally: finished.set() loop = asyncio.get_running_loop() previous = loop.get_exception_handler() loop.set_exception_handler(lambda _, context: reports.append(context)) try: async with running(app) as (_, address): _, writer = await asyncio.open_connection(*address) writer.write(b'GET / HTTP/1.1\r\nHost: x\r\n\r\n') await asyncio.wait_for(started.wait(), 2) writer.close() await writer.wait_closed() await asyncio.wait_for(finished.wait(), 2) > assert reports == [] E AssertionError: assert [{'exception'...tion failed'}] == [] E E Left contains one more item: {'exception': OSError('Client disconnected'), 'message': 'ASGI application failed'} E Use -v to get more diff tests/test_http.py:724: AssertionError =========================== short test summary info ============================ FAILED tests/test_http.py::test_server_disconnect_error_is_not_logged_as_application_failure 1 failed in 0.08s