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

Function test_postloop_hook

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

Source from the content-addressed store, hash-verified

343
344
345def test_postloop_hook(capsys) -> None:
346 # Need to patch sys.argv so cmd2 doesn't think it was called with arguments equal to the py.test args
347 testargs = ["prog", "say hello", "quit"]
348
349 with mock.patch.object(sys, "argv", testargs):
350 app = PluggedApp()
351
352 app.register_postloop_hook(app.prepost_hook_one)
353 app.cmdloop()
354 out, err = capsys.readouterr()
355 assert out == "hello\none\n"
356 assert not err
357
358
359def test_postloop_hooks(capsys) -> None:

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…