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:22:19 +0100
commit9dd6822f734fb5b231cc0aa81b6c4d5352e2d7df (patch)
tree255971cb7fd3971f0be34103bd99ac4ca86990d2 /xtesting/utils
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/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()