diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-01-26 09:49:49 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-01-26 15:56:30 +0100 |
commit | 01efa1e4229157b46d352bce202ed4192992dd3f (patch) | |
tree | 7544230a1ab504b1b5458f2e96c31476aa6d5293 /functest/utils | |
parent | bbfe9b09d2b1ac7bfe286311fef83d36c6125c96 (diff) |
Fix last Pylint error in Functest
It also fixes all pylint warnings in router and the related unit
tests. tox.ini is updated to ensure that no error is introduced.
Change-Id: Iddd74b0dac7b6581d72b04369140006c9e19f998
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/utils')
-rw-r--r-- | functest/utils/env.py | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/functest/utils/env.py b/functest/utils/env.py index f0952500..f6e6e100 100644 --- a/functest/utils/env.py +++ b/functest/utils/env.py @@ -1,52 +1,54 @@ #!/usr/bin/env python -import pkg_resources +# pylint: disable=missing-docstring + import os import re +import pkg_resources import six -default_envs = { - 'NODE_NAME': 'unknown_pod', - 'CI_DEBUG': 'false', - 'DEPLOY_SCENARIO': 'os-nosdn-nofeature-noha', - 'DEPLOY_TYPE': 'virt', - 'INSTALLER_TYPE': None, - 'INSTALLER_IP': None, - 'BUILD_TAG': None, - 'OS_ENDPOINT_TYPE': None, - 'OS_AUTH_URL': None, - 'CONFIG_FUNCTEST_YAML': pkg_resources.resource_filename( - 'functest', 'ci/config_functest.yaml'), - 'OS_INSECURE': '', - 'OS_REGION_NAME': 'RegionOne' -} - - -class Environment(object): +class Environment(object): # pylint: disable=too-few-public-methods + + default_envs = { + 'NODE_NAME': 'unknown_pod', + 'CI_DEBUG': 'false', + 'DEPLOY_SCENARIO': 'os-nosdn-nofeature-noha', + 'DEPLOY_TYPE': 'virt', + 'INSTALLER_TYPE': None, + 'INSTALLER_IP': None, + 'BUILD_TAG': None, + 'OS_ENDPOINT_TYPE': None, + 'OS_AUTH_URL': None, + 'CONFIG_FUNCTEST_YAML': pkg_resources.resource_filename( + 'functest', 'ci/config_functest.yaml'), + 'OS_INSECURE': '', + 'OS_REGION_NAME': 'RegionOne' + } def __init__(self): - for k, v in six.iteritems(os.environ): - self.__setattr__(k, v) - for k, v in six.iteritems(default_envs): - if k not in os.environ: - self.__setattr__(k, v) + for key, value in six.iteritems(os.environ): + setattr(self, key, value) + for key, value in six.iteritems(self.default_envs): + if key not in os.environ: + setattr(self, key, value) self._set_ci_run() if 'CI_LOOP' not in os.environ: self._set_ci_loop() def _set_ci_run(self): - if self.BUILD_TAG: - self.IS_CI_RUN = True + if getattr(self, "BUILD_TAG"): + setattr(self, "IS_CI_RUN", True) else: - self.IS_CI_RUN = False + setattr(self, "IS_CI_RUN", False) def _set_ci_loop(self): - if self.BUILD_TAG and re.search("daily", self.BUILD_TAG): - self.CI_LOOP = "daily" + if (getattr(self, "BUILD_TAG") and + re.search("daily", getattr(self, "BUILD_TAG"))): + setattr(self, "CI_LOOP", "daily") else: - self.CI_LOOP = "weekly" + setattr(self, "CI_LOOP", "weekly") ENV = Environment() |