aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Ollivier <cedric.ollivier@orange.com>2018-02-13 10:13:36 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-02-13 10:13:36 +0000
commit5387e9adab29aa72a0cbdea0615799eccaf6781d (patch)
tree66aca6a665ba9ed5772e937f6511d54dcbb0177f
parentfb85975fee7c3c67d3b10df58e4b742034fbd2ab (diff)
parent46f1037fe35bc249dca868b363107bc1bcd70469 (diff)
Merge "Improve the way of setting values in CONST"
-rw-r--r--functest/opnfv_tests/sdn/odl/odl.py4
-rw-r--r--functest/utils/config.py2
-rw-r--r--functest/utils/constants.py4
3 files changed, 5 insertions, 5 deletions
diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index 25cc758ea..6af49ffaf 100644
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -38,7 +38,7 @@ __author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
class ODLTests(robotframework.RobotFramework):
"""ODL test runner."""
- odl_test_repo = constants.CONST.__getattribute__('dir_repo_odl_test')
+ odl_test_repo = getattr(constants.CONST, 'dir_repo_odl_test')
neutron_suite_dir = os.path.join(
odl_test_repo, "csit/suites/openstack/neutron")
basic_suite_dir = os.path.join(
@@ -51,7 +51,7 @@ class ODLTests(robotframework.RobotFramework):
def __init__(self, **kwargs):
super(ODLTests, self).__init__(**kwargs)
self.res_dir = os.path.join(
- constants.CONST.__getattribute__('dir_results'), 'odl')
+ getattr(constants.CONST, 'dir_results'), 'odl')
self.xml_file = os.path.join(self.res_dir, 'output.xml')
@classmethod
diff --git a/functest/utils/config.py b/functest/utils/config.py
index 050f12a92..c569856b1 100644
--- a/functest/utils/config.py
+++ b/functest/utils/config.py
@@ -45,7 +45,7 @@ class Config(object):
for param_n, param_v in six.iteritems(left_parametes):
attr_further = self._get_attr_further(attr_now, param_n)
if attr_further:
- self.__setattr__(attr_further, param_v)
+ setattr(self, attr_further, param_v)
if isinstance(param_v, dict):
self._parse(attr_further, param_v)
diff --git a/functest/utils/constants.py b/functest/utils/constants.py
index cb3ea7875..c19e0fc52 100644
--- a/functest/utils/constants.py
+++ b/functest/utils/constants.py
@@ -12,9 +12,9 @@ class Constants(object): # pylint: disable=too-few-public-methods
def __init__(self):
for attr_n, attr_v in six.iteritems(config.CONF.__dict__):
- self.__setattr__(attr_n, attr_v)
+ setattr(self, attr_n, attr_v)
for env_n, env_v in six.iteritems(env.ENV.__dict__):
- self.__setattr__(env_n, env_v)
+ setattr(self, env_n, env_v)
CONST = Constants()