aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/cmd
diff options
context:
space:
mode:
authorrexlee8776 <limingjiang@huawei.com>2017-11-20 03:28:31 +0000
committerRex Lee <limingjiang@huawei.com>2017-12-15 06:20:51 +0000
commit32c0d6daa4742911c999aff47a18e085f68769af (patch)
tree34fc84f2683d0fa159d08b704a383b9577be0f78 /yardstick/cmd
parent9613b999df420e0f0244fd8a1b51d62a9c8de73f (diff)
pretty cli format: runner/scenario/testcase list
JIRA: YARDSTICK-855 1. using prettytable to reformat cli below: yardstick runner list yardstick scenario list yardstick testcase list 2. remove redundant function print_hbar 3. fix pep8 problems, the framework using do_list dynamicly, so disable unused-argument check for now. Change-Id: I79e1226e21fca4624bf4436414917bd07ecabca0 Signed-off-by: rexlee8776 <limingjiang@huawei.com>
Diffstat (limited to 'yardstick/cmd')
-rw-r--r--yardstick/cmd/__init__.py16
-rw-r--r--yardstick/cmd/commands/testcase.py17
2 files changed, 7 insertions, 26 deletions
diff --git a/yardstick/cmd/__init__.py b/yardstick/cmd/__init__.py
index 3756d9ebb..e69de29bb 100644
--- a/yardstick/cmd/__init__.py
+++ b/yardstick/cmd/__init__.py
@@ -1,16 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-from __future__ import print_function
-
-
-def print_hbar(barlen):
- """print to stdout a horizontal bar"""
- print(("+"), end=' ')
- print(("-" * barlen), end=' ')
- print("+")
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)