(capsys)
| 343 | |
| 344 | |
| 345 | def 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 | |
| 359 | def test_postloop_hooks(capsys) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…