(monkeypatch)
| 1028 | |
| 1029 | |
| 1030 | def test_base_cmdloop_without_startup_commands(monkeypatch) -> None: |
| 1031 | # Need to patch sys.argv so cmd2 doesn't think it was called with arguments equal to the py.test args |
| 1032 | testargs = ["prog"] |
| 1033 | with mock.patch.object(sys, "argv", testargs): |
| 1034 | app = create_outsim_app() |
| 1035 | |
| 1036 | app.intro = "Hello World, this is an intro ..." |
| 1037 | |
| 1038 | read_command_mock = mock.MagicMock(name="_read_command_line", return_value="quit") |
| 1039 | monkeypatch.setattr("cmd2.Cmd._read_command_line", read_command_mock) |
| 1040 | |
| 1041 | expected = app.intro + "\n" |
| 1042 | |
| 1043 | # Run the command loop |
| 1044 | app.cmdloop() |
| 1045 | out = app.stdout.getvalue() |
| 1046 | assert out == expected |
| 1047 | |
| 1048 | |
| 1049 | def test_cmdfinalizations_runs(base_app, monkeypatch) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…