aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/core/unit.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/unit.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/unit.py')
-rw-r--r--xtesting/core/unit.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/xtesting/core/unit.py b/xtesting/core/unit.py
index e6c3cd87..10feb886 100644
--- a/xtesting/core/unit.py
+++ b/xtesting/core/unit.py
@@ -56,7 +56,7 @@ class Suite(testcase.TestCase):
Exception
"""
stream.seek(0)
- with open("{}/results.xml".format(self.res_dir), "w") as xml:
+ with open(f"{self.res_dir}/results.xml", "w", encoding='utf-8') as xml:
with subprocess.Popen(
['subunit2junitxml'], stdin=subprocess.PIPE,
stdout=subprocess.PIPE) as stats:
@@ -69,7 +69,7 @@ class Suite(testcase.TestCase):
Raises:
CalledProcessError
"""
- cmd = ['subunit2html', stream, '{}/results.html'.format(self.res_dir)]
+ cmd = ['subunit2html', stream, f'{self.res_dir}/results.html']
output = subprocess.check_output(cmd)
self.__logger.debug("\n%s\n\n%s", ' '.join(cmd), output)
@@ -117,10 +117,10 @@ class Suite(testcase.TestCase):
stream=stream, verbosity=2).run(self.suite).decorated
self.generate_stats(stream)
self.generate_xunit(stream)
- with open('{}/subunit_stream'.format(self.res_dir), 'wb') as subfd:
+ with open(f'{self.res_dir}/subunit_stream', 'wb') as subfd:
stream.seek(0)
shutil.copyfileobj(stream, subfd)
- self.generate_html('{}/subunit_stream'.format(self.res_dir))
+ self.generate_html(f'{self.res_dir}/subunit_stream')
self.stop_time = time.time()
self.details = {
"testsRun": result.testsRun,