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

Function test_skip_postcmd_hooks

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

Source from the content-addressed store, hash-verified

955
956
957def test_skip_postcmd_hooks(capsys) -> None:
958 app = PluggedApp()
959 app.register_postcmd_hook(app.postcmd_hook)
960 app.register_cmdfinalization_hook(app.cmdfinalization_hook)
961
962 # Cause a SkipPostcommandHooks exception and verify no postcmd stuff runs but cmdfinalization_hook still does
963 app.onecmd_plus_hooks("skip_postcmd_hooks")
964 out, _err = capsys.readouterr()
965 assert "In do_skip_postcmd_hooks" in out
966 assert app.called_postcmd == 0
967 assert app.called_cmdfinalization == 1
968
969
970def test_cmd2_argparse_exception(capsys) -> None:

Callers

nothing calls this directly

Calls 4

PluggedAppClass · 0.85
register_postcmd_hookMethod · 0.80
onecmd_plus_hooksMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…