Skip to content

Commit 230e5a8

Browse files
committed
Fixes tests
1 parent 5f88af6 commit 230e5a8

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

SoftLayer/shell/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535

3636

3737
class ShellExit(Exception):
38+
"""Exception raised to quit the shell."""
3839
pass
3940

4041

4142
@click.command()
4243
@environment.pass_env
43-
@click.pass_context
44-
def cli(ctx, env):
44+
def cli(env):
4545
"""Enters a shell for slcli."""
4646
env.load_modules_from_python(ALL_ROUTES)
4747
env.aliases.update(ALL_ALIASES)

SoftLayer/tests/CLI/core_tests.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
class 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

tools/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ requests
22
click
33
prettytable >= 0.7.0
44
six >= 1.7.0
5+
prompt_toolkit

0 commit comments

Comments
 (0)