diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2017-05-03 14:11:38 +0200 |
---|---|---|
committer | Jose Lausuch <jose.lausuch@ericsson.com> | 2017-05-05 12:50:46 +0000 |
commit | f5c2aaa5ea6dce72fda01a3392d88148264eb02b (patch) | |
tree | b84fa1e753749b28f5259e94e67d22e75fde5a20 /functest/ci/run_tests.py | |
parent | a92a31aac7656e8beaeed49eae5f1e4af2f46e86 (diff) |
Replace CONST.* by getattribute/setattr
Directories affected:
- ci
- core
and respective unit tests
Change-Id: I6a3d5aa68de29fc5a37ae543a067ff797eba33e6
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'functest/ci/run_tests.py')
-rwxr-xr-x | functest/ci/run_tests.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py index d1361260..073e09a7 100755 --- a/functest/ci/run_tests.py +++ b/functest/ci/run_tests.py @@ -75,7 +75,7 @@ def print_separator(str, count=45): def source_rc_file(): - rc_file = CONST.openstack_creds + rc_file = CONST.__getattribute__('openstack_creds') if not os.path.isfile(rc_file): raise Exception("RC file %s does not exist..." % rc_file) logger.debug("Sourcing the OpenStack RC file...") @@ -83,13 +83,13 @@ def source_rc_file(): for key, value in os.environ.iteritems(): if re.search("OS_", key): if key == 'OS_AUTH_URL': - CONST.OS_AUTH_URL = value + CONST.__setattr__('OS_AUTH_URL', value) elif key == 'OS_USERNAME': - CONST.OS_USERNAME = value + CONST.__setattr__('OS_USERNAME', value) elif key == 'OS_TENANT_NAME': - CONST.OS_TENANT_NAME = value + CONST.__setattr__('OS_TENANT_NAME', value) elif key == 'OS_PASSWORD': - CONST.OS_PASSWORD = value + CONST.__setattr__('OS_PASSWORD', value) def generate_os_snapshot(): @@ -211,7 +211,8 @@ def run_all(tiers): for tier in tiers.get_tiers(): if (len(tier.get_tests()) != 0 and - re.search(CONST.CI_LOOP, tier.get_ci_loop()) is not None): + re.search(CONST.__getattribute__('CI_LOOP'), + tier.get_ci_loop()) is not None): tiers_to_run.append(tier) summary += ("\n - %s:\n\t %s" % (tier.get_name(), @@ -227,11 +228,10 @@ def run_all(tiers): def main(**kwargs): - CI_INSTALLER_TYPE = CONST.INSTALLER_TYPE - CI_SCENARIO = CONST.DEPLOY_SCENARIO - file = CONST.functest_testcases_yaml - _tiers = tb.TierBuilder(CI_INSTALLER_TYPE, CI_SCENARIO, file) + _tiers = tb.TierBuilder(CONST.__getattribute__('INSTALLER_TYPE'), + CONST.__getattribute__('DEPLOY_SCENARIO'), + file) if kwargs['noclean']: GlobalVariables.CLEAN_FLAG = False @@ -256,7 +256,8 @@ def main(**kwargs): logger.error("Unknown test case or tier '%s', " "or not supported by " "the given scenario '%s'." - % (kwargs['test'], CI_SCENARIO)) + % (kwargs['test'], + CONST.__getattribute__('DEPLOY_SCENARIO'))) logger.debug("Available tiers are:\n\n%s" % _tiers) return Result.EX_ERROR |