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

Function test_postloop_hooks

tests/test_plugin.py:359–371  ·  view source on GitHub ↗
(capsys)

Source from the content-addressed store, hash-verified

357
358
359def test_postloop_hooks(capsys) -> None:
360 # Need to patch sys.argv so cmd2 doesn't think it was called with arguments equal to the py.test args
361 testargs = ["prog", "say hello", "quit"]
362
363 with mock.patch.object(sys, "argv", testargs):
364 app = PluggedApp()
365
366 app.register_postloop_hook(app.prepost_hook_one)
367 app.register_postloop_hook(app.prepost_hook_two)
368 app.cmdloop()
369 out, err = capsys.readouterr()
370 assert out == "hello\none\ntwo\n"
371 assert not err
372
373
374###

Callers

nothing calls this directly

Calls 3

PluggedAppClass · 0.85
cmdloopMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…