Skip to content

Commit

Permalink
Open yaml files with utf-8 encoding for extra_model_paths.yaml (#6807)
Browse files Browse the repository at this point in the history
* Using utf-8 encoding for yaml files.

* Fix test assertion.
  • Loading branch information
robinjhuang authored Feb 14, 2025
1 parent 019c702 commit 042a905
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests-unit/utils/extra_config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_load_extra_model_paths_expands_userpath(
mock_yaml_safe_load.assert_called_once()

# Check if open was called with the correct file path
mock_file.assert_called_once_with(dummy_yaml_file_name, 'r')
mock_file.assert_called_once_with(dummy_yaml_file_name, 'r', encoding='utf-8')


@patch('builtins.open', new_callable=mock_open)
Expand Down
2 changes: 1 addition & 1 deletion utils/extra_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging

def load_extra_path_config(yaml_path):
with open(yaml_path, 'r') as stream:
with open(yaml_path, 'r', encoding='utf-8') as stream:
config = yaml.safe_load(stream)
yaml_dir = os.path.dirname(os.path.abspath(yaml_path))
for c in config:
Expand Down

0 comments on commit 042a905

Please sign in to comment.