(capsys)
| 843 | |
| 844 | |
| 845 | def test_cmdfinalization(capsys) -> None: |
| 846 | app = PluggedApp() |
| 847 | app.onecmd_plus_hooks("say hello") |
| 848 | out, err = capsys.readouterr() |
| 849 | assert out == "hello\n" |
| 850 | assert not err |
| 851 | assert app.called_cmdfinalization == 0 |
| 852 | |
| 853 | app.register_cmdfinalization_hook(app.cmdfinalization_hook) |
| 854 | app.onecmd_plus_hooks("say hello") |
| 855 | out, err = capsys.readouterr() |
| 856 | assert out == "hello\n" |
| 857 | assert not err |
| 858 | assert app.called_cmdfinalization == 1 |
| 859 | |
| 860 | # register the function again, so it should be called twice |
| 861 | app.reset_counters() |
| 862 | app.register_cmdfinalization_hook(app.cmdfinalization_hook) |
| 863 | app.onecmd_plus_hooks("say hello") |
| 864 | out, err = capsys.readouterr() |
| 865 | assert out == "hello\n" |
| 866 | assert not err |
| 867 | assert app.called_cmdfinalization == 2 |
| 868 | |
| 869 | |
| 870 | def test_cmdfinalization_stop_first(capsys) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…