From ff58c792e41250f9745e34f028373d48300acac8 Mon Sep 17 00:00:00 2001 From: umarcor Date: Tue, 28 Sep 2021 12:58:34 +0200 Subject: [PATCH] lint: specify encoding when using 'open' --- vunit/test/runner.py | 2 +- vunit/ui/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vunit/test/runner.py b/vunit/test/runner.py index 03fe4f02bc..a4b118656b 100644 --- a/vunit/test/runner.py +++ b/vunit/test/runner.py @@ -307,7 +307,7 @@ def _print_output(self, output_file_name): """ Print contents of output file if it exists """ - with Path(output_file_name).open("r") as fread: + with Path(output_file_name).open("r", encoding="utf-8") as fread: for line in fread.readlines(): self._stdout_ansi.write(line) diff --git a/vunit/ui/__init__.py b/vunit/ui/__init__.py index 710044af90..80ed8e1be6 100644 --- a/vunit/ui/__init__.py +++ b/vunit/ui/__init__.py @@ -248,7 +248,7 @@ def add_source_files_from_csv(self, project_csv_path: Union[str, Path], vhdl_sta ppath = Path(project_csv_path) - with ppath.open() as csv_path_file: + with ppath.open("r", encoding="utf-8") as csv_path_file: for row in csv.reader(csv_path_file): if len(row) == 2: lib_name = row[0].strip() @@ -828,7 +828,7 @@ def _main_export_json(self, json_file_name: Union[str, Path]): # pylint: disabl tests=tests, ) - with Path(json_file_name).open("w") as fptr: + with Path(json_file_name).open("w", encoding="utf-8") as fptr: json.dump(json_data, fptr, sort_keys=True, indent=4, separators=(",", ": ")) return True