aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/cmd/commands/testcase.py
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2017-12-18 01:33:02 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-12-18 01:33:02 +0000
commite268fa7ae7c17604ecad787d6940fdf77426dc0f (patch)
treeff9144429cec5a98d81d8038d67af096e8df3bd8 /yardstick/cmd/commands/testcase.py
parent9d0f99349d2ea4499670708aacb1569cad0389aa (diff)
parent32c0d6daa4742911c999aff47a18e085f68769af (diff)
Merge "pretty cli format: runner/scenario/testcase list"
Diffstat (limited to 'yardstick/cmd/commands/testcase.py')
-rw-r--r--yardstick/cmd/commands/testcase.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/yardstick/cmd/commands/testcase.py b/yardstick/cmd/commands/testcase.py
index a151871b3..7bdcdf003 100644
--- a/yardstick/cmd/commands/testcase.py
+++ b/yardstick/cmd/commands/testcase.py
@@ -8,11 +8,11 @@
##############################################################################
""" Handler for yardstick command 'testcase' """
-from __future__ import print_function
from __future__ import absolute_import
+import prettytable
+
from yardstick.benchmark.core.testcase import Testcase
-from yardstick.benchmark.core import print_hbar
from yardstick.common.utils import cliargs
from yardstick.cmd.commands import change_osloobj_to_paras
from yardstick.cmd.commands import Commands
@@ -24,7 +24,7 @@ class TestcaseCommands(Commands):
Set of commands to discover and display test cases.
"""
- def do_list(self, args):
+ def do_list(self, *args):
"""List existing test cases"""
testcase_list = self.client.get('/yardstick/testcases')['result']
self._format_print(testcase_list)
@@ -37,11 +37,8 @@ class TestcaseCommands(Commands):
def _format_print(self, testcase_list):
"""format output"""
-
- print_hbar(88)
- print("| %-21s | %-60s" % ("Testcase Name", "Description"))
- print_hbar(88)
+ case_table = prettytable.PrettyTable(['Testcase Name', 'Description'])
+ case_table.align = 'l'
for testcase_record in testcase_list:
- print("| %-16s | %-60s" % (testcase_record['Name'],
- testcase_record['Description']))
- print_hbar(88)
+ case_table.add_row([testcase_record['Name'], testcase_record['Description']])
+ print(case_table)