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

Function console

test/mitmproxy/tools/console/conftest.py:37–56  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

35
36@pytest.fixture
37async def console(monkeypatch) -> ConsoleTestMaster: # noqa
38 # monkeypatch.setattr(window.Screen, "get_cols_rows", lambda self: (120, 120))
39 monkeypatch.setattr(window.Screen, "start", lambda *_: True)
40 monkeypatch.setattr(ConsoleTestMaster, "sig_call_in", lambda *_, **__: True)
41 monkeypatch.setattr(sys.stdout, "isatty", lambda: True)
42
43 # extremely hacky: the console UI heavily depends on global signals
44 # that are unfortunately shared across tests
45 # Here we clear all existing signals so that we don't interact with previous instantiations.
46 for sig in signals.__dict__.values():
47 if isinstance(sig, _SignalMixin):
48 sig.receivers.clear()
49
50 opts = options.Options()
51 m = ConsoleTestMaster(opts)
52 opts.server = False
53 opts.console_mouse = False
54 await m.running()
55 yield m
56 await m.done()

Callers

nothing calls this directly

Calls 5

ConsoleTestMasterClass · 0.85
valuesMethod · 0.80
clearMethod · 0.45
runningMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…