aboutsummaryrefslogtreecommitdiffstats
path: root/functest/cli
diff options
context:
space:
mode:
Diffstat (limited to 'functest/cli')
-rw-r--r--functest/cli/cli_base.py6
-rw-r--r--functest/cli/commands/cli_env.py5
-rw-r--r--functest/cli/commands/cli_os.py6
-rw-r--r--functest/cli/commands/cli_testcase.py9
-rw-r--r--functest/cli/commands/cli_tier.py9
5 files changed, 18 insertions, 17 deletions
diff --git a/functest/cli/cli_base.py b/functest/cli/cli_base.py
index 2f085834..54b3e72b 100644
--- a/functest/cli/cli_base.py
+++ b/functest/cli/cli_base.py
@@ -9,12 +9,12 @@
import click
import logging.config
+import pkg_resources
from functest.cli.commands.cli_env import CliEnv
from functest.cli.commands.cli_os import CliOpenStack
from functest.cli.commands.cli_testcase import CliTestcase
from functest.cli.commands.cli_tier import CliTier
-from functest.utils.constants import CONST
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@@ -23,8 +23,8 @@ CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group(context_settings=CONTEXT_SETTINGS)
@click.version_option(version='opnfv colorado.0.1 ')
def cli():
- logging.config.fileConfig(
- CONST.__getattribute__('dir_functest_logging_cfg'))
+ logging.config.fileConfig(pkg_resources.resource_filename(
+ 'functest', 'ci/logging.ini'))
_env = CliEnv()
diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py
index 8094c84e..ce977572 100644
--- a/functest/cli/commands/cli_env.py
+++ b/functest/cli/commands/cli_env.py
@@ -8,6 +8,7 @@
#
import os
+import pkg_resources
import click
import prettytable
@@ -35,8 +36,8 @@ class CliEnv(object):
else:
answer = raw_input("Invalid answer. Please type [y|n]\n")
- cmd = ("python %s/functest/ci/prepare_env.py start" %
- CONST.__getattribute__('dir_repo_functest'))
+ cmd = ("python %s start" % pkg_resources.resource_filename(
+ 'functest', 'ci/prepare_env.py'))
ft_utils.execute_command(cmd)
def show(self):
diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py
index c66362fc..875529f2 100644
--- a/functest/cli/commands/cli_os.py
+++ b/functest/cli/commands/cli_os.py
@@ -9,6 +9,7 @@
import os
+import pkg_resources
import click
@@ -49,9 +50,8 @@ class CliOpenStack(object):
def check(self):
self.ping_endpoint()
- cmd = os.path.join(CONST.__getattribute__('dir_repo_functest'),
- "functest/ci/check_os.sh")
- ft_utils.execute_command(cmd, verbose=False)
+ ft_utils.execute_command("sh %s" % pkg_resources.resource_filename(
+ 'functest', 'ci/check_os.sh'), verbose=False)
def snapshot_create(self):
self.ping_endpoint()
diff --git a/functest/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py
index 3d3f1cb3..91904d87 100644
--- a/functest/cli/commands/cli_testcase.py
+++ b/functest/cli/commands/cli_testcase.py
@@ -10,6 +10,7 @@
""" global variables """
import os
+import pkg_resources
import click
@@ -25,7 +26,7 @@ class CliTestcase(object):
self.tiers = tb.TierBuilder(
CONST.__getattribute__('INSTALLER_TYPE'),
CONST.__getattribute__('DEPLOY_SCENARIO'),
- CONST.__getattribute__('functest_testcases_yaml'))
+ pkg_resources.resource_filename('functest', 'ci/testcases.yaml'))
def list(self):
summary = ""
@@ -59,8 +60,8 @@ class CliTestcase(object):
else:
tests = testname.split(",")
for test in tests:
- cmd = ("python %s/functest/ci/run_tests.py "
- "%s -t %s" %
- (CONST.__getattribute__('dir_repo_functest'),
+ cmd = ("python %s %s -t %s" %
+ (pkg_resources.resource_filename(
+ 'functest', 'ci/run_tests.py'),
flags, test))
ft_utils.execute_command(cmd)
diff --git a/functest/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py
index 531f0ff9..48e9f542 100644
--- a/functest/cli/commands/cli_tier.py
+++ b/functest/cli/commands/cli_tier.py
@@ -10,6 +10,7 @@
""" global variables """
import os
+import pkg_resources
import click
@@ -24,7 +25,7 @@ class CliTier(object):
self.tiers = tb.TierBuilder(
CONST.__getattribute__('INSTALLER_TYPE'),
CONST.__getattribute__('DEPLOY_SCENARIO'),
- CONST.__getattribute__('functest_testcases_yaml'))
+ pkg_resources.resource_filename('functest', 'ci/testcases.yaml'))
def list(self):
summary = ""
@@ -67,8 +68,6 @@ class CliTier(object):
click.echo("Functest environment is not ready. "
"Run first 'functest env prepare'")
else:
- cmd = ("python %s/functest/ci/run_tests.py "
- "%s -t %s" %
- (CONST.__getattribute__('dir_repo_functest'),
- flags, tiername))
+ cmd = ("python %s %s -t %s" % (pkg_resources.resource_filename(
+ 'functest', 'ci/run_tests.py'), flags, tiername))
ft_utils.execute_command(cmd)