MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_exception

Method test_exception

test/mitmproxy/addons/test_script.py:107–123  ·  view source on GitHub ↗
(self, tdata, caplog_async)

Source from the content-addressed store, hash-verified

105 sc.done()
106
107 async def test_exception(self, tdata, caplog_async):
108 caplog_async.set_level("INFO")
109 with taddons.context() as tctx:
110 sc = script.Script(
111 tdata.path("mitmproxy/data/addonscripts/error.py"),
112 True,
113 )
114 tctx.master.addons.add(sc)
115 await caplog_async.await_log("error load")
116 tctx.configure(sc)
117
118 f = tflow.tflow(resp=True)
119 tctx.master.addons.trigger(HttpRequestHook(f))
120
121 await caplog_async.await_log("ValueError: Error!")
122 await caplog_async.await_log("error.py")
123 sc.done()
124
125 def test_import_error(self, monkeypatch, tdata, caplog):
126 monkeypatch.setattr(sys, "frozen", True, raising=False)

Callers

nothing calls this directly

Calls 9

doneMethod · 0.95
HttpRequestHookClass · 0.90
set_levelMethod · 0.80
contextMethod · 0.80
await_logMethod · 0.80
triggerMethod · 0.80
pathMethod · 0.45
addMethod · 0.45
configureMethod · 0.45

Tested by

no test coverage detected