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

Function test_runcmds_plus_hooks

tests/test_cmd2.py:507–522  ·  view source on GitHub ↗
(base_app, request)

Source from the content-addressed store, hash-verified

505
506
507def test_runcmds_plus_hooks(base_app, request) -> None:
508 test_dir = os.path.dirname(request.module.__file__)
509 prefilepath = os.path.join(test_dir, "scripts", "precmds.txt")
510 postfilepath = os.path.join(test_dir, "scripts", "postcmds.txt")
511
512 base_app.runcmds_plus_hooks(["run_script " + prefilepath, "help", "shortcuts", "run_script " + postfilepath])
513 expected = f"""
514run_script {prefilepath}
515set allow_style Always
516help
517shortcuts
518run_script {postfilepath}
519set allow_style Terminal"""
520
521 out, _err = run_cmd(base_app, "history -s")
522 assert out == normalize(expected)
523
524
525def test_runcmds_plus_hooks_ctrl_c(base_app, capsys) -> None:

Callers

nothing calls this directly

Calls 3

run_cmdFunction · 0.85
normalizeFunction · 0.85
runcmds_plus_hooksMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…