Skip to content

Commit afa55a4

Browse files
authored
fix file io bug (#8)
* fix file io bug * fix load file io bug
1 parent bb7ddc9 commit afa55a4

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lyrebird_api_coverage/client/load_base.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ def auto_load_base():
3434
# 通过本地默认base文件获取base
3535
elif not os.path.exists(DEFAULT_BASE):
3636
copy_file(DEFAULT_BASE)
37-
if not codecs.open(DEFAULT_BASE, 'r', 'utf-8').read():
38-
get_logger().error('Base is None.Please check your base file of API-Coverage.')
39-
else:
40-
json_obj = json.loads(codecs.open(DEFAULT_BASE, 'r', 'utf-8').read())
37+
with codecs.open(DEFAULT_BASE, 'r', 'utf-8') as f:
38+
json_obj = json.load(f)
4139
app_context.base_sha1 = get_file_sha1(DEFAULT_BASE)
4240
return json_obj
4341

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='lyrebird-api-coverage',
11-
version='0.2.3',
11+
version='0.2.4',
1212
packages=['lyrebird_api_coverage'],
1313
url='https://github.com/meituan/lyrebird-api-coverage',
1414
author='HBQA',

0 commit comments

Comments
 (0)