summaryrefslogtreecommitdiffstats
path: root/vnftest/common
diff options
context:
space:
mode:
authorMoshe <moshehoa@amdocs.com>2018-07-04 09:10:44 +0300
committerMoshe Hoadley <moshehoa@amdocs.com>2018-07-12 07:11:09 +0000
commitfc9a8346809137810f9c85a232191d4edb7c9fb3 (patch)
tree70f637c2269a10a1840f1ea3319cbc1e6f84f4ab /vnftest/common
parentd9784d158cbdb1d46b14b9ae00436ce0ab7d4ed2 (diff)
resources are located by logical path
Issue-ID: VNFSDK-275 Change-Id: I2a8a5430634d5a12a58fbd5cd85511ccce53518a Signed-off-by: Moshe <moshehoa@amdocs.com> fix tests Issue-ID: VNFSDK-275 Change-Id: I20f48139b2cae3b57959a33739f34e811c2ffe38 Signed-off-by: Moshe <moshehoa@amdocs.com>
Diffstat (limited to 'vnftest/common')
-rw-r--r--vnftest/common/constants.py9
-rw-r--r--vnftest/common/utils.py8
2 files changed, 10 insertions, 7 deletions
diff --git a/vnftest/common/constants.py b/vnftest/common/constants.py
index 8bbe070..46db92c 100644
--- a/vnftest/common/constants.py
+++ b/vnftest/common/constants.py
@@ -29,13 +29,10 @@ from vnftest.common.yaml_loader import yaml_load
dirname = os.path.dirname
abspath = os.path.abspath
join = os.path.join
-sep = os.path.sep
CONF = {}
CONF_FILE = None
-VNFTEST_ROOT_PATH = dirname(
- dirname(abspath(pkg_resources.resource_filename(__name__, "")))) + sep
-
+VNFTEST_ROOT_PATH = os.environ.get('VNFTEST_ROOT_PATH', dirname(dirname(abspath(pkg_resources.resource_filename(__name__, "")))) + os.path.sep)
def get_param(key, default=''):
# don't re-parse yaml for each lookup
@@ -93,8 +90,8 @@ LOG_DIR = get_param('dir.log', join(VNFTEST_ROOT_PATH, 'tmp/vnftest/'))
TASK_LOG_DIR = get_param('dir.tasklog', join(VNFTEST_ROOT_PATH, 'var/log/vnftest/'))
CONF_SAMPLE_DIR = join(REPOS_DIR, 'etc/vnftest/')
SAMPLE_CASE_DIR = join(REPOS_DIR, 'samples')
-TESTCASE_DIR = join(VNFTEST_ROOT_PATH, 'tests/onap/test_cases/')
-TESTSUITE_DIR = join(VNFTEST_ROOT_PATH, 'tests/onap/test_suites/')
+TESTCASE_DIR = join(VNFTEST_ROOT_PATH, 'vnftest/test_config/onap/test_cases/')
+TESTSUITE_DIR = join(VNFTEST_ROOT_PATH, 'vnftest/test_config/onap/test_suites/')
# file
DEFAULT_OUTPUT_FILE = get_param('file.output_file', join(VNFTEST_ROOT_PATH, 'tmp/vnftest.out'))
diff --git a/vnftest/common/utils.py b/vnftest/common/utils.py
index 406796d..10edc05 100644
--- a/vnftest/common/utils.py
+++ b/vnftest/common/utils.py
@@ -514,6 +514,7 @@ def load_resource(path):
def format(st, params):
if not isinstance(st, basestring):
return st
+ dotdict(params)
ret_str = ""
ret_obj = None
for literal_text, field_name, format_spec, conversion in \
@@ -522,7 +523,12 @@ def format(st, params):
ret_str = ret_str + literal_text
else:
dict = ret_obj or params
- value = dict[field_name]
+ try:
+ value = dict[field_name]
+ except KeyError:
+ dict = dotdict(dict)
+ field_name = '{' + field_name + '}'
+ value = field_name.format(**dict)
if isinstance(value, basestring):
ret_str = ret_str + value
else: