MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / test_exception_handler

Function test_exception_handler

test/mitmproxy/test_master.py:11–33  ·  view source on GitHub ↗
(caplog_async)

Source from the content-addressed store, hash-verified

9
10
11async def test_exception_handler(caplog_async):
12 caplog_async.set_level("ERROR")
13
14 # start proxy master and let it initialize its exception handler
15 master = Master(None)
16 running = asyncio.create_task(master.run())
17 await asyncio.sleep(0)
18
19 # create a task with an unhandled exception...
20 task = asyncio.create_task(err())
21 # make sure said task is run...
22 await asyncio.sleep(0)
23
24 # and garbage-collected...
25 assert task
26 del task
27 gc.collect()
28
29 # and ensure that this triggered a log entry.
30 await caplog_async.await_log("Traceback")
31
32 master.shutdown()
33 await running

Callers

nothing calls this directly

Calls 6

runMethod · 0.95
shutdownMethod · 0.95
MasterClass · 0.90
set_levelMethod · 0.80
await_logMethod · 0.80
errFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…