(capsys)
| 357 | |
| 358 | |
| 359 | def 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 | ### |
nothing calls this directly
no test coverage detected
searching dependent graphs…