From 17739d718901a10f7ec0aaf9a6d53141294a347d 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 --- xtesting/core/testcase.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'xtesting/core/testcase.py') diff --git a/xtesting/core/testcase.py b/xtesting/core/testcase.py index 672ba3f7..f7814f72 100644 --- a/xtesting/core/testcase.py +++ b/xtesting/core/testcase.py @@ -105,9 +105,10 @@ class TestCase(metaclass=abc.ABCMeta): assert self.stop_time if self.stop_time < self.start_time: return "XX:XX" - return "{}:{}".format( - str(int(self.stop_time - self.start_time) // 60).zfill(2), - str(int(self.stop_time - self.start_time) % 60).zfill(2)) + return( + f"{str(int(self.stop_time - self.start_time) // 60).zfill(2)}:" + f"{str(int(self.stop_time - self.start_time) % 60).zfill(2)}") + except Exception: # pylint: disable=broad-except self.__logger.error("Please run test before getting the duration") return "XX:XX" @@ -314,7 +315,7 @@ class TestCase(metaclass=abc.ABCMeta): ExtraArgs={'ContentType': mime_type[ 0] or 'application/octet-stream'}) link = os.path.join(dst_http_url, log_file) - output_str += "\n{}".format(link) + output_str += f"\n{link}" self.details["links"].append(link) for root, _, files in os.walk(self.res_dir): for pub_file in files: @@ -334,7 +335,7 @@ class TestCase(metaclass=abc.ABCMeta): link = os.path.join(dst_http_url, os.path.relpath( os.path.join(root, pub_file), start=self.dir_results)) - output_str += "\n{}".format(link) + output_str += f"\n{link}" self.details["links"].append(link) self.__logger.info( "All artifacts were successfully published: %s\n", output_str) -- cgit 1.2.3-korg