From e22f8db5261c4013c7bfb76df20f725b3fb18dda Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Tue, 15 Mar 2022 19:59:51 +0100 Subject: [PATCH] add asyncio exception handler test --- test/mitmproxy/test_master.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/mitmproxy/test_master.py b/test/mitmproxy/test_master.py index 777ab4dd1..f74fe68e2 100644 --- a/test/mitmproxy/test_master.py +++ b/test/mitmproxy/test_master.py @@ -1 +1,16 @@ -# TODO: write tests +import asyncio + +from mitmproxy.test.taddons import RecordingMaster + + +async def err(): + raise RuntimeError + + +async def test_exception_handler(): + m = RecordingMaster(None) + running = asyncio.create_task(m.run()) + asyncio.create_task(err()) + await m.await_log("Traceback", level="error") + m.shutdown() + await running