(capsys)
| 302 | |
| 303 | |
| 304 | def test_preloop_hook(capsys) -> None: |
| 305 | # Need to patch sys.argv so cmd2 doesn't think it was called with arguments equal to the py.test args |
| 306 | testargs = ["prog", "say hello", "quit"] |
| 307 | |
| 308 | with mock.patch.object(sys, "argv", testargs): |
| 309 | app = PluggedApp() |
| 310 | |
| 311 | app.register_preloop_hook(app.prepost_hook_one) |
| 312 | app.cmdloop() |
| 313 | out, err = capsys.readouterr() |
| 314 | assert out == "one\nhello\n" |
| 315 | assert not err |
| 316 | |
| 317 | |
| 318 | def test_preloop_hooks(capsys) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…