aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/utils
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:21:47 +0100
commit17739d718901a10f7ec0aaf9a6d53141294a347d (patch)
treea98e6d09a42016ceec90713adac681918a4a9c62 /xtesting/utils
parent92681911699428a87ea56c0263832b96a93da3da (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/utils')
-rw-r--r--xtesting/utils/decorators.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/xtesting/utils/decorators.py b/xtesting/utils/decorators.py
index 2ce12fa7..2de0b816 100644
--- a/xtesting/utils/decorators.py
+++ b/xtesting/utils/decorators.py
@@ -30,12 +30,13 @@ def can_dump_request_to_file(method):
except OSError as ex:
if ex.errno != errno.EEXIST:
raise
- with open(parseresult.path, 'a') as dumpfile:
+ with open(parseresult.path, 'a', encoding='utf-8') as dumpfile:
headers = ""
for key in request.headers:
headers += key + " " + request.headers[key] + "\n"
- message = "{} {}\n{}\n{}\n\n\n".format(
- request.method, request.url, headers, request.body)
+ message = (
+ f"{request.method} {request.url}"
+ f"\n{headers}\n{request.body}\n\n\n")
dumpfile.write(message)
return mock.Mock()