diff options
author | 2021-11-09 11:22:02 +0100 | |
---|---|---|
committer | 2021-11-09 13:21:47 +0100 | |
commit | 17739d718901a10f7ec0aaf9a6d53141294a347d (patch) | |
tree | a98e6d09a42016ceec90713adac681918a4a9c62 /xtesting/core/feature.py | |
parent | 92681911699428a87ea56c0263832b96a93da3da (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>
Diffstat (limited to 'xtesting/core/feature.py')
-rw-r--r-- | xtesting/core/feature.py | 6 |
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: |