MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_cannot_print

Function test_cannot_print

test/mitmproxy/addons/test_termlog.py:49–63  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

47
48
49async def test_cannot_print(monkeypatch) -> None:
50 def _raise(*args, **kwargs):
51 raise OSError
52
53 monkeypatch.setattr(builtins, "print", _raise)
54
55 t = termlog.TermLog()
56 with taddons.context(t) as tctx:
57 tctx.configure(t)
58 with pytest.raises(SystemExit) as exc_info:
59 logging.info("Should not log this, but raise instead")
60
61 assert exc_info.value.args[0] == 1
62
63 t.uninstall()

Callers

nothing calls this directly

Calls 4

uninstallMethod · 0.95
contextMethod · 0.80
infoMethod · 0.80
configureMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…