MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / test_py_bridge_capture_isolation

Function test_py_bridge_capture_isolation

tests/test_run_pyscript.py:127–143  ·  view source on GitHub ↗

Verify that PyBridge captures poutput but not raw print from within a command.

()

Source from the content-addressed store, hash-verified

125
126
127def test_py_bridge_capture_isolation() -> None:
128 """Verify that PyBridge captures poutput but not raw print from within a command."""
129 import cmd2
130 from cmd2.py_bridge import PyBridge
131
132 class App(cmd2.Cmd):
133 def do_test_capture(self, _):
134 print("process_stdout")
135 self.poutput("app_stdout")
136
137 app = App()
138 bridge = PyBridge(app)
139 result = bridge("test_capture")
140
141 # Verify isolation: only the application stream should be in the result
142 assert result.stdout == "app_stdout\n"
143 assert "process_stdout" not in result.stdout
144
145
146def test_run_pyscript_stop(base_app, request) -> None:

Callers

nothing calls this directly

Calls 2

PyBridgeClass · 0.90
AppClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…