3 # jose.lausuch@ericsson.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
10 """ global variables """
17 import functest.ci.tier_builder as tb
18 from functest.utils.constants import CONST
19 import functest.utils.functest_utils as ft_utils
20 import functest.utils.functest_vacation as vacation
23 class CliTestcase(object):
26 self.tiers = tb.TierBuilder(
27 CONST.__getattribute__('INSTALLER_TYPE'),
28 CONST.__getattribute__('DEPLOY_SCENARIO'),
29 pkg_resources.resource_filename('functest', 'ci/testcases.yaml'))
33 for tier in self.tiers.get_tiers():
34 for test in tier.get_tests():
35 summary += (" %s\n" % test.get_name())
38 def show(self, testname):
39 description = self.tiers.get_test(testname)
40 if description is None:
41 click.echo("The test case '%s' does not exist or is not supported."
44 click.echo(description)
47 def run(testname, noclean=False, report=False):
55 if testname == 'vacation':
57 elif not os.path.isfile(CONST.__getattribute__('env_active')):
58 click.echo("Functest environment is not ready. "
59 "Run first 'functest env prepare'")
61 tests = testname.split(",")
63 cmd = "run_tests {}-t {}".format(flags, test)
64 ft_utils.execute_command(cmd)