From 6ff14fe8826bcb0f635319a51032900c862a9728 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sat, 11 Sep 2021 10:24:53 +0200 Subject: Set encoding utf-8 when opening file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4e756552173247499ba882bfee4fbe8738fbae3d Signed-off-by: Cédric Ollivier --- functest_kubernetes/rally/rally_kubernetes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'functest_kubernetes/rally/rally_kubernetes.py') 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() -- cgit 1.2.3-korg