(capsys)
| 892 | |
| 893 | |
| 894 | def test_cmdfinalization_hook_exception(capsys) -> None: |
| 895 | app = PluggedApp() |
| 896 | app.register_cmdfinalization_hook(app.cmdfinalization_hook_exception) |
| 897 | stop = app.onecmd_plus_hooks("say hello") |
| 898 | out, err = capsys.readouterr() |
| 899 | assert not stop |
| 900 | assert out == "hello\n" |
| 901 | assert err |
| 902 | assert app.called_cmdfinalization == 1 |
| 903 | |
| 904 | # register another function, but it shouldn't be called |
| 905 | app.reset_counters() |
| 906 | app.register_cmdfinalization_hook(app.cmdfinalization_hook) |
| 907 | stop = app.onecmd_plus_hooks("say hello") |
| 908 | out, err = capsys.readouterr() |
| 909 | assert not stop |
| 910 | assert out == "hello\n" |
| 911 | assert err |
| 912 | assert app.called_cmdfinalization == 1 |
| 913 | |
| 914 | |
| 915 | def test_cmdfinalization_hook_system_exit() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…