MCPcopy Create free account
hub / github.com/python-cmd2/cmd2 / test_autoload_commands

Function test_autoload_commands

tests/test_commandset.py:130–149  ·  view source on GitHub ↗
(autoload_command_sets_app)

Source from the content-addressed store, hash-verified

128
129
130def test_autoload_commands(autoload_command_sets_app) -> None:
131 # verifies that, when autoload is enabled, CommandSets and registered functions all show up
132
133 cmds_cats, _help_topics = autoload_command_sets_app._build_command_info()
134
135 assert "Alone" in cmds_cats
136 assert "elderberry" in cmds_cats["Alone"]
137 assert "main" in cmds_cats["Alone"]
138
139 # Test subcommand was autoloaded
140 result = autoload_command_sets_app.app_cmd("main sub")
141 assert "Subcommand Ran" in result.stdout
142
143 assert "Also Alone" in cmds_cats
144 assert "durian" in cmds_cats["Also Alone"]
145
146 assert "Fruits" in cmds_cats
147 assert "cranberry" in cmds_cats["Fruits"]
148
149 assert "Command Set B" not in cmds_cats
150
151
152def test_command_synonyms() -> None:

Callers

nothing calls this directly

Calls 2

_build_command_infoMethod · 0.80
app_cmdMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…