aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/core/testcase.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/testcase.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/testcase.py')
-rw-r--r--xtesting/core/testcase.py11
1 files changed, 6 insertions, 5 deletions
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)