diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2021-09-11 10:24:53 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2021-09-11 10:55:16 +0200 |
commit | d2d72bbb71c3f772d099765ba1b06f8cf3060392 (patch) | |
tree | f7ea35807ea8a1757116507199d83cd952111515 /functest_kubernetes/rally | |
parent | 9dae8dbe3cbfcac3d0fbf4a6b4421fa7eb8b2175 (diff) |
Set encoding utf-8 when opening file
Change-Id: I4e756552173247499ba882bfee4fbe8738fbae3d
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit 5a565816e30dcb5aefb2feb33acce7ef7a457cc0)
Diffstat (limited to 'functest_kubernetes/rally')
-rw-r--r-- | functest_kubernetes/rally/rally_kubernetes.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/functest_kubernetes/rally/rally_kubernetes.py b/functest_kubernetes/rally/rally_kubernetes.py index 3543fa99..ef7949ef 100644 --- a/functest_kubernetes/rally/rally_kubernetes.py +++ b/functest_kubernetes/rally/rally_kubernetes.py @@ -65,7 +65,8 @@ class RallyKubernetes(testcase.TestCase): result['existing@kubernetes']['message']) return with open(pkg_resources.resource_filename( - 'functest_kubernetes', 'rally/all-in-one.yaml')) as file: + 'functest_kubernetes', 'rally/all-in-one.yaml'), + encoding='utf-8') as file: template = Template(file.read()) task = yaml.safe_load(template.render( concurrency=kwargs.get("concurrency", self.concurrency), @@ -90,7 +91,7 @@ class RallyKubernetes(testcase.TestCase): self.res_dir, "{}.html".format(self.case_name))) if "files" in result: for path in result["files"]: - with open(path, "w+") as output: + with open(path, "w+", encoding='utf-8') as output: output.write(result["files"][path]) result = rapi.task.export( [task_instance["uuid"]], "junit-xml", @@ -98,6 +99,6 @@ class RallyKubernetes(testcase.TestCase): self.res_dir, "{}.xml".format(self.case_name))) if "files" in result: for path in result["files"]: - with open(path, "w+") as output: + with open(path, "w+", encoding='utf-8') as output: output.write(result["files"][path]) self.stop_time = time.time() |