aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/ci
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2021-11-09 11:22:02 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2021-11-09 13:22:19 +0100
commit9dd6822f734fb5b231cc0aa81b6c4d5352e2d7df (patch)
tree255971cb7fd3971f0be34103bd99ac4ca86990d2 /xtesting/ci
parentd130de7e57f8394104654da3f37afb631538aa2b (diff)
Leverage latest pylint features
It adds encoding in all open call and leverage f-strings. Change-Id: I70ccd2bfcadae44929d5874f98fa3bf4ff644488 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 17739d718901a10f7ec0aaf9a6d53141294a347d)
Diffstat (limited to 'xtesting/ci')
-rw-r--r--xtesting/ci/run_tests.py10
-rw-r--r--xtesting/ci/tier_builder.py2
2 files changed, 6 insertions, 6 deletions
diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py
index cf7fe425..bc2b43d8 100644
--- a/xtesting/ci/run_tests.py
+++ b/xtesting/ci/run_tests.py
@@ -97,7 +97,7 @@ class Runner():
if not os.path.isfile(rc_file):
LOGGER.debug("No env file %s found", rc_file)
return
- with open(rc_file, "r") as rcfd:
+ with open(rc_file, "r", encoding='utf-8') as rcfd:
for line in rcfd:
var = (line.rstrip('"\n').replace('export ', '').split(
"=") if re.search(r'(.*)=(.*)', line) else None)
@@ -115,7 +115,7 @@ class Runner():
def get_dict_by_test(testname):
# pylint: disable=missing-docstring
with open(pkg_resources.resource_filename(
- 'xtesting', 'ci/testcases.yaml')) as tyaml:
+ 'xtesting', 'ci/testcases.yaml'), encoding='utf-8') as tyaml:
testcases_yaml = yaml.safe_load(tyaml)
for dic_tier in testcases_yaml.get("tiers"):
for dic_testcase in dic_tier['testcases']:
@@ -209,8 +209,8 @@ class Runner():
self.overall_result = Result.EX_ERROR
if test.is_blocking():
raise BlockingTestFailed(
- "The test case {} failed and is blocking".format(
- test.get_name()))
+ f"The test case {test.get_name()} "
+ "failed and is blocking")
return self.overall_result
def run_all(self):
@@ -310,7 +310,7 @@ def main():
os.makedirs(constants.RESULTS_DIR)
except OSError as ex:
if ex.errno != errno.EEXIST:
- print("{} {}".format("Cannot create", constants.RESULTS_DIR))
+ print(f"Cannot create {constants.RESULTS_DIR}")
return testcase.TestCase.EX_RUN_ERROR
if env.get('DEBUG').lower() == 'true':
logging.config.fileConfig(pkg_resources.resource_filename(
diff --git a/xtesting/ci/tier_builder.py b/xtesting/ci/tier_builder.py
index 9b8ac7df..7658b7ce 100644
--- a/xtesting/ci/tier_builder.py
+++ b/xtesting/ci/tier_builder.py
@@ -29,7 +29,7 @@ class TierBuilder():
self.generate_tiers()
def read_test_yaml(self):
- with open(self.testcases_file) as tc_file:
+ with open(self.testcases_file, encoding='utf-8') as tc_file:
self.testcases_yaml = yaml.safe_load(tc_file)
self.dic_tier_array = []