diff options
author | Vincent Danno <vincent.danno@orange.com> | 2021-05-18 21:17:41 +0200 |
---|---|---|
committer | Vincent Danno <vincent.danno@orange.com> | 2021-05-18 21:26:42 +0200 |
commit | c9f92317cf20465987ff187733dd620e8d1fdc4f (patch) | |
tree | b164812a3beeb9e7377ab636c1b677dfeab1a369 /xtesting | |
parent | d340a8e8f99fef80c5fa3a45c4e1b06e5b0aeb39 (diff) |
Use constants instead of hard-coding paths
This complements
https://gerrit.opnfv.org/gerrit/c/functest-xtesting/+/72495
which missed one occurence due to trailing slash difference.
Signed-off-by: Vincent Danno <vincent.danno@orange.com>
Change-Id: Iabfa89161cc099c924a7609aeb4ef6ed1b027cd3
Diffstat (limited to 'xtesting')
-rw-r--r-- | xtesting/core/testcase.py | 9 | ||||
-rw-r--r-- | xtesting/utils/constants.py | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/xtesting/core/testcase.py b/xtesting/core/testcase.py index 8faf3f43..08ce426b 100644 --- a/xtesting/core/testcase.py +++ b/xtesting/core/testcase.py @@ -28,6 +28,7 @@ from six.moves import urllib from xtesting.utils import decorators from xtesting.utils import env +from xtesting.utils import constants __author__ = "Cedric Ollivier <cedric.ollivier@orange.com>" @@ -55,7 +56,7 @@ class TestCase(): EX_PUBLISH_ARTIFACTS_ERROR = os.EX_SOFTWARE - 4 """publish_artifacts() failed""" - dir_results = "/var/lib/xtesting/results" + dir_results = constants.RESULTS_DIR _job_name_rule = "(dai|week)ly-(.+?)-[0-9]*" headers = {'Content-Type': 'application/json'} __logger = logging.getLogger(__name__) @@ -69,9 +70,9 @@ class TestCase(): self.start_time = 0 self.stop_time = 0 self.is_skipped = False - self.output_log_name = 'xtesting.log' - self.output_debug_log_name = 'xtesting.debug.log' - self.res_dir = "{}/{}".format(self.dir_results, self.case_name) + self.output_log_name = os.path.basename(constants.LOG_PATH) + self.output_debug_log_name = os.path.basename(constants.DEBUG_LOG_PATH) + self.res_dir = os.path.join(self.dir_results, self.case_name) def __str__(self): try: diff --git a/xtesting/utils/constants.py b/xtesting/utils/constants.py index 7677f2e5..acd0d31d 100644 --- a/xtesting/utils/constants.py +++ b/xtesting/utils/constants.py @@ -6,7 +6,7 @@ import os ENV_FILE = '/var/lib/xtesting/conf/env_file' -RESULTS_DIR = '/var/lib/xtesting/results/' +RESULTS_DIR = '/var/lib/xtesting/results' LOG_PATH = os.path.join(RESULTS_DIR, 'xtesting.log') DEBUG_LOG_PATH = os.path.join(RESULTS_DIR, 'xtesting.debug.log') |