From 9dd6822f734fb5b231cc0aa81b6c4d5352e2d7df Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 9 Nov 2021 11:22:02 +0100 Subject: Leverage latest pylint features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It adds encoding in all open call and leverage f-strings. Change-Id: I70ccd2bfcadae44929d5874f98fa3bf4ff644488 Signed-off-by: Cédric Ollivier (cherry picked from commit 17739d718901a10f7ec0aaf9a6d53141294a347d) --- xtesting/core/feature.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'xtesting/core/feature.py') 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: -- cgit 1.2.3-korg