zulip_bots: Use utf-8 when reading fixtures.

This prevents issues with Python using platform
specific encodings, such as CP1252 on Windows.
This commit is contained in:
Robert Hönig 2017-12-14 11:22:21 +01:00 committed by showell
parent ced3a97b3f
commit a475077da9

View file

@ -29,7 +29,7 @@ def read_bot_fixture_data(bot_name, test_name):
base_path = os.path.realpath(os.path.join(os.path.dirname( base_path = os.path.realpath(os.path.join(os.path.dirname(
os.path.abspath(__file__)), 'bots', bot_name, 'fixtures')) os.path.abspath(__file__)), 'bots', bot_name, 'fixtures'))
http_data_path = os.path.join(base_path, '{}.json'.format(test_name)) http_data_path = os.path.join(base_path, '{}.json'.format(test_name))
with open(http_data_path) as f: with open(http_data_path, encoding='utf-8') as f:
content = f.read() content = f.read()
http_data = json.loads(content) http_data = json.loads(content)
return http_data return http_data