| 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) |