Skip to content

Commit e4636e1

Browse files
committed
Add test for hidden commands
1 parent d13d332 commit e4636e1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,35 @@ def thing():
166166

167167
self._assert_correct_output(root, expected_output)
168168

169+
def test_hidden_command(self):
170+
major_version = int(click.__version__.split('.')[0])
171+
if major_version < 7:
172+
return
173+
174+
@click.group(name='root')
175+
def root():
176+
pass
177+
178+
@root.command(name='command-one')
179+
def command_one():
180+
pass
181+
182+
@root.command(name='command-two', hidden=True)
183+
def command_two():
184+
pass
185+
186+
@root.command(name='command-three')
187+
def command_three():
188+
pass
189+
190+
expected_output = """
191+
root
192+
├── command-one
193+
└── command-three
194+
"""[1:]
195+
196+
self._assert_correct_output(root, expected_output)
197+
169198
def _assert_correct_output(self, root, expected_output):
170199
with captured_output() as (out, err):
171200
tree = _build_command_tree(root)

0 commit comments

Comments
 (0)