Skip to content

Commit

Permalink
lint: specify encoding when using 'open'
Browse files Browse the repository at this point in the history
  • Loading branch information
umarcor committed Oct 8, 2021
1 parent 45a7878 commit ff58c79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion vunit/test/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions vunit/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ff58c79

Please sign in to comment.