tests.test_tree module

Tests for the command-tree rendering feature.

tests.test_tree.OBSERVATORY_TREE = 'observatory                     Weather observatory control center.\n├── help [COMMAND_PATH]...      Show help for a command.\n├── report CITY                 Print the forecast for a city.\n├── station (st)                Manage remote weather stations.\n│   ├── calibrate               Recalibrate the sensors.\n│   ├── help [COMMAND_PATH]...  Show help for a command.\n│   └── reboot                  Power-cycle the station. (DEPRECATED)\n└── status                      Report the current conditions.'

Expected unstyled tree of the observatory fixture CLI.

Descriptions are column-aligned on the longest rail-plus-label row, hidden commands are skipped, aliases are parenthesized, operand metavars follow the command name and deprecated commands carry their marker. The help entries are the implicit subcommand every click-extra group registers.

tests.test_tree.runner()[source]
tests.test_tree.test_render_tree_structure()[source]
tests.test_tree.test_render_tree_non_group()[source]
tests.test_tree.test_render_tree_hidden_skipped()[source]
tests.test_tree.test_render_tree_prog_name_override()[source]
tests.test_tree.test_render_tree_theme_styling()[source]

Nodes reuse the same theme slots and styling as help screens.

tests.test_tree.test_render_tree_paints_each_choice_of_an_operand()[source]

An operand enumerating its values draws them the way a help screen does.

Painted one value at a time rather than as a single metavar span, so a reader picks the accepted words out of the punctuation around them.

tests.test_tree.test_render_tree_paints_the_deprecation_label()[source]

The marker takes the slot the help screen paints it with.

A description reaches the tree already carrying Click’s label, and it is the only part of a node the name-and-metavar pass does not style.

tests.test_tree.test_render_tree_wraps_descriptions()[source]

Long descriptions wrap in the aligned column, rail running through.

tests.test_tree.test_tree_option_prints_and_exits(runner)[source]
tests.test_tree.test_tree_option_colored(runner)[source]
tests.test_tree.test_tree_option_accessible_ascii_rail(runner)[source]

Accessibility mode degrades the box-drawing rail to pure ASCII.

tests.test_tree.test_tree_option_in_help(runner)[source]
tests.test_tree.kitchen_script(tmp_path)[source]
tests.test_tree.test_wrap_tree_renders_tree(runner, kitchen_script)[source]
tests.test_tree.test_wrap_tree_drills_into_subcommand(runner, kitchen_script)[source]

Extra arguments after SCRIPT re-root the tree at the nested subcommand.

tests.test_tree.test_wrap_tree_accessible_ascii_rail(runner, kitchen_script)[source]

Accessibility mode carries over from the wrapping context.

tests.test_tree.test_wrap_tree_mutually_exclusive(runner, kitchen_script, conflicting)[source]
tests.test_tree.test_wrap_tree_unresolvable_target(runner)[source]