Skip to content

Commit

Permalink
Explicitly use utf-8 encoding for config file
Browse files Browse the repository at this point in the history
Signed-off-by: Jürgen Kreileder <[email protected]>
  • Loading branch information
jkreileder committed Jan 1, 2024
1 parent f338aa3 commit 04f7633
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cf_ips_to_hcloud_fw/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def create_parser() -> argparse.ArgumentParser:

def read_config(config_file: str) -> list[Project]:
try:
with open(config_file) as file:
with open(config_file, encoding="utf-8") as file:
config = yaml.safe_load(file)
except FileNotFoundError:
log_error_and_exit(f"Config file {config_file} not found.")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_read_config_file_not_found(
read_config("config.yaml")
assert e.type is SystemExit
assert e.value.code == 1
mock_open.assert_called_once_with("config.yaml")
mock_open.assert_called_once_with("config.yaml", encoding="utf-8")
mock_logging.assert_called_once()
assert mock_logging.call_args[0][0].startswith("Config file config.yaml not found.")

Expand Down

0 comments on commit 04f7633

Please sign in to comment.