X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Fcli%2Fcommands%2Fcli_testcase.py;h=3d3f1cb3e400c9cfbed4753dfdf25f94ad773a04;hb=refs%2Fchanges%2F55%2F34955%2F1;hp=efe177d52230872857a6019d071c5ac26c0f8fb5;hpb=e2de95f657cdeabd5c6aa4decaaee39e69f0ca32;p=functest.git diff --git a/functest/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py index efe177d52..3d3f1cb3e 100644 --- a/functest/cli/commands/cli_testcase.py +++ b/functest/cli/commands/cli_testcase.py @@ -14,19 +14,18 @@ import os import click import functest.ci.tier_builder as tb +from functest.utils.constants import CONST import functest.utils.functest_utils as ft_utils import functest.utils.functest_vacation as vacation -import functest.utils.functest_constants as ft_constants -class CliTestcase: +class CliTestcase(object): def __init__(self): - CI_INSTALLER_TYPE = ft_constants.CI_INSTALLER_TYPE - CI_SCENARIO = ft_constants.CI_SCENARIO - testcases = ft_constants.FUNCTEST_TESTCASES_YAML - - self.tiers = tb.TierBuilder(CI_INSTALLER_TYPE, CI_SCENARIO, testcases) + self.tiers = tb.TierBuilder( + CONST.__getattribute__('INSTALLER_TYPE'), + CONST.__getattribute__('DEPLOY_SCENARIO'), + CONST.__getattribute__('functest_testcases_yaml')) def list(self): summary = "" @@ -43,17 +42,25 @@ class CliTestcase: click.echo(description) - def run(self, testname, noclean=False): + @staticmethod + def run(testname, noclean=False, report=False): + + flags = "" + if noclean: + flags += "-n " + if report: + flags += "-r " + if testname == 'vacation': vacation.main() - elif not os.path.isfile(ft_constants.ENV_FILE): + elif not os.path.isfile(CONST.__getattribute__('env_active')): click.echo("Functest environment is not ready. " "Run first 'functest env prepare'") else: - if noclean: - cmd = ("python %s/functest/ci/run_tests.py " - "-n -t %s" % (ft_constants.FUNCTEST_REPO_DIR, testname)) - else: + tests = testname.split(",") + for test in tests: cmd = ("python %s/functest/ci/run_tests.py " - "-t %s" % (ft_constants.FUNCTEST_REPO_DIR, testname)) - ft_utils.execute_command(cmd) + "%s -t %s" % + (CONST.__getattribute__('dir_repo_functest'), + flags, test)) + ft_utils.execute_command(cmd)