(capsys)
| 506 | |
| 507 | |
| 508 | def test_postparsing_hook_emptystatement_second(capsys) -> None: |
| 509 | app = PluggedApp() |
| 510 | app.register_postparsing_hook(app.postparse_hook) |
| 511 | stop = app.onecmd_plus_hooks("say hello") |
| 512 | out, err = capsys.readouterr() |
| 513 | assert not stop |
| 514 | assert out == "hello\n" |
| 515 | assert not err |
| 516 | assert app.called_postparsing == 1 |
| 517 | |
| 518 | # register another function and make sure it gets called |
| 519 | app.reset_counters() |
| 520 | app.register_postparsing_hook(app.postparse_hook_emptystatement) |
| 521 | stop = app.onecmd_plus_hooks("say hello") |
| 522 | out, err = capsys.readouterr() |
| 523 | assert not stop |
| 524 | assert not out |
| 525 | assert not err |
| 526 | assert app.called_postparsing == 2 |
| 527 | |
| 528 | # register a third function which shouldn't be called |
| 529 | app.reset_counters() |
| 530 | app.register_postparsing_hook(app.postparse_hook) |
| 531 | stop = app.onecmd_plus_hooks("say hello") |
| 532 | out, err = capsys.readouterr() |
| 533 | assert not stop |
| 534 | assert not out |
| 535 | assert not err |
| 536 | assert app.called_postparsing == 2 |
| 537 | |
| 538 | |
| 539 | def test_postparsing_hook_exception(capsys) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…