MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / test_exit_code_nonzero

Function test_exit_code_nonzero

tests/test_cmd2.py:3660–3671  ·  view source on GitHub ↗
(exit_code_repl, monkeypatch)

Source from the content-addressed store, hash-verified

3658
3659
3660def test_exit_code_nonzero(exit_code_repl, monkeypatch) -> None:
3661 app = exit_code_repl
3662
3663 read_input_mock = mock.MagicMock(name="_read_command_line", return_value="exit 23")
3664 monkeypatch.setattr("cmd2.Cmd._read_command_line", read_input_mock)
3665
3666 expected = "exiting with code: 23\n"
3667
3668 # Run the command loop
3669 app.cmdloop()
3670 out = app.stdout.getvalue()
3671 assert out == expected
3672
3673
3674class AnsiApp(cmd2.Cmd):

Callers

nothing calls this directly

Calls 2

cmdloopMethod · 0.80
getvalueMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…