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

Method test_reload

test/mitmproxy/addons/test_script.py:86–105  ·  view source on GitHub ↗
(self, tmp_path, caplog_async)

Source from the content-addressed store, hash-verified

84 sc.done()
85
86 async def test_reload(self, tmp_path, caplog_async):
87 caplog_async.set_level("INFO")
88 with taddons.context() as tctx:
89 f = tmp_path / "foo.py"
90 f.write_text("\n")
91 sc = script.Script(str(f), True)
92 tctx.configure(sc)
93 await caplog_async.await_log("Loading")
94 caplog_async.clear()
95
96 for i in range(20):
97 # Some filesystems only have second-level granularity,
98 # so just writing once again is not good enough.
99 f.write_text("\n")
100 if "Loading" in caplog_async.caplog.text:
101 break
102 await asyncio.sleep(0.1)
103 else:
104 raise AssertionError("No reload seen")
105 sc.done()
106
107 async def test_exception(self, tdata, caplog_async):
108 caplog_async.set_level("INFO")

Callers

nothing calls this directly

Calls 6

doneMethod · 0.95
set_levelMethod · 0.80
contextMethod · 0.80
await_logMethod · 0.80
configureMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected