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

Function test_base_cmdloop_with_startup_commands

tests/test_cmd2.py:1013–1027  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1011
1012
1013def test_base_cmdloop_with_startup_commands() -> None:
1014 intro = "Hello World, this is an intro ..."
1015
1016 # Need to patch sys.argv so cmd2 doesn't think it was called with arguments equal to the py.test args
1017 testargs = ["prog", "quit"]
1018 expected = intro + "\n"
1019
1020 with mock.patch.object(sys, "argv", testargs):
1021 app = create_outsim_app()
1022
1023 # Run the command loop with custom intro
1024 app.cmdloop(intro=intro)
1025
1026 out = app.stdout.getvalue()
1027 assert out == expected
1028
1029
1030def test_base_cmdloop_without_startup_commands(monkeypatch) -> None:

Callers

nothing calls this directly

Calls 3

create_outsim_appFunction · 0.85
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…