summaryrefslogtreecommitdiffstats
path: root/functest/cli/commands/cli_testcase.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-01-23 11:19:41 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-01-24 15:15:34 +0100
commitbbfe9b09d2b1ac7bfe286311fef83d36c6125c96 (patch)
treec11ad97f5672454a3b7e2ba13916034919933e5d /functest/cli/commands/cli_testcase.py
parentc653ed78d7721b9933e08015e45dd39379aa4316 (diff)
Fix pylint warnings/errors in cli
cli_testcase and cli_tier have been refactored to avoid duplicating code. Then functest/cli and funtest/unit/cli can be added to the list of modules rated 10/10. Change-Id: Iec90e806397248a10f39080ec554e3f0a6eda7c1 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/cli/commands/cli_testcase.py')
-rw-r--r--functest/cli/commands/cli_testcase.py47
1 files changed, 14 insertions, 33 deletions
diff --git a/functest/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py
index a424a05b..a8ead5f5 100644
--- a/functest/cli/commands/cli_testcase.py
+++ b/functest/cli/commands/cli_testcase.py
@@ -5,26 +5,16 @@
# 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
-#
-
-""" global variables """
-import pkg_resources
+# pylint: disable=missing-docstring
import click
-import functest.ci.tier_builder as tb
-from functest.utils.constants import CONST
-import functest.utils.functest_utils as ft_utils
-
+from functest.cli.commands import cli_tier
+from functest.utils import functest_utils
-class Testcase(object):
- def __init__(self):
- self.tiers = tb.TierBuilder(
- CONST.__getattribute__('INSTALLER_TYPE'),
- CONST.__getattribute__('DEPLOY_SCENARIO'),
- pkg_resources.resource_filename('functest', 'ci/testcases.yaml'))
+class Testcase(cli_tier.Tier):
def list(self):
summary = ""
@@ -33,37 +23,28 @@ class Testcase(object):
summary += (" %s\n" % test.get_name())
return summary
- def show(self, testname):
- description = self.tiers.get_test(testname)
+ def show(self, name):
+ description = self.tiers.get_test(name)
return description
@staticmethod
- def run(testname, noclean=False, report=False):
-
- flags = ""
- if noclean:
- flags += "-n "
- if report:
- flags += "-r "
-
- tests = testname.split(",")
+ def run(name, noclean=False, report=False):
+ tests = name.split(",")
for test in tests:
- cmd = "run_tests {}-t {}".format(flags, test)
- ft_utils.execute_command(cmd)
+ cmd = "run_tests {}-t {}".format(
+ Testcase.get_flags(noclean, report), test)
+ functest_utils.execute_command(cmd)
class CliTestcase(Testcase):
- def __init__(self):
- super(CliTestcase, self).__init__()
-
def list(self):
click.echo(super(CliTestcase, self).list())
- def show(self, testname):
- testcase_show = super(CliTestcase, self).show(testname)
+ def show(self, name):
+ testcase_show = super(CliTestcase, self).show(name)
if testcase_show:
click.echo(testcase_show)
else:
click.echo("The test case '%s' does not exist or is not supported."
- % testname)
+ % name)