1919class CoreTests (testing .TestCase ):
2020
2121 def test_load_all (self ):
22- for path , cmd in recursive_subcommand_loader (core .cli , path = 'root' ):
22+ for path , cmd in recursive_subcommand_loader (core .cli ,
23+ current_path = 'root' ):
2324 try :
2425 cmd .main (args = ['--help' ])
2526 except SystemExit as ex :
@@ -98,7 +99,7 @@ def test_auth_error(self, stdoutmock, climock):
9899 self .assertIn ("use 'slcli config setup'" , stdoutmock .getvalue ())
99100
100101
101- def recursive_subcommand_loader (root , path = '' ):
102+ def recursive_subcommand_loader (root , current_path = '' ):
102103 """Recursively load and list every command."""
103104
104105 if getattr (root , 'list_commands' , None ) is None :
@@ -107,9 +108,10 @@ def recursive_subcommand_loader(root, path=''):
107108 ctx = click .Context (root )
108109
109110 for command in root .list_commands (ctx ):
110- new_path = '%s:%s' % (path , command )
111+ new_path = '%s:%s' % (current_path , command )
111112 logging .info ("loading %s" , new_path )
112113 new_root = root .get_command (ctx , command )
113- for path , cmd in recursive_subcommand_loader (new_root , path = new_path ):
114+ for path , cmd in recursive_subcommand_loader (new_root ,
115+ current_path = new_path ):
114116 yield path , cmd
115- yield path , new_root
117+ yield current_path , new_root
0 commit comments