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 Testcase(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)
43 def run(testname, noclean=False, report=False):
51 if testname == 'vacation':
53 elif not os.path.isfile(CONST.__getattribute__('env_active')):
54 click.echo("Functest environment is not ready. "
55 "Run first 'functest env prepare'")
57 tests = testname.split(",")
59 cmd = "run_tests {}-t {}".format(flags, test)
60 ft_utils.execute_command(cmd)
63 class CliTestcase(Testcase):
66 super(CliTestcase, self).__init__()
69 click.echo(super(CliTestcase, self).list())
71 def show(self, testname):
72 testcase_show = super(CliTestcase, self).show(testname)
74 click.echo(testcase_show)
76 click.echo("The test case '%s' does not exist or is not supported."