aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/core/feature.py
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/core/feature.py
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/core/feature.py')
-rw-r--r--xtesting/core/feature.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/xtesting/core/feature.py b/xtesting/core/feature.py
index 5a02bb6a..8cc9a210 100644
--- a/xtesting/core/feature.py
+++ b/xtesting/core/feature.py
@@ -86,7 +86,7 @@ class BashFeature(Feature):
def __init__(self, **kwargs):
super().__init__(**kwargs)
- self.result_file = "{}/{}.log".format(self.res_dir, self.case_name)
+ self.result_file = f"{self.res_dir}/{self.case_name}.log"
def execute(self, **kwargs):
"""Execute the cmd passed as arg
@@ -105,7 +105,7 @@ class BashFeature(Feature):
max_duration = kwargs.get("max_duration")
if not os.path.isdir(self.res_dir):
os.makedirs(self.res_dir)
- with open(self.result_file, 'w') as f_stdout:
+ with open(self.result_file, 'w', encoding='utf-8') as f_stdout:
self.__logger.info("Calling %s", cmd)
with subprocess.Popen(
cmd, shell=True, stdout=subprocess.PIPE,
@@ -122,7 +122,7 @@ class BashFeature(Feature):
"Killing process after %d second(s).",
max_duration)
return -2
- with open(self.result_file, 'r') as f_stdin:
+ with open(self.result_file, 'r', encoding='utf-8') as f_stdin:
self.__logger.debug("$ %s\n%s", cmd, f_stdin.read().rstrip())
return process.returncode
except KeyError: