refactor: use loader.load_cases to validate test files

This commit is contained in:
debugtalk
2019-12-30 21:50:36 +08:00
parent 5483b49935
commit 3213f5bf5d
5 changed files with 26 additions and 28 deletions

View File

@@ -22,7 +22,12 @@ def _load_yaml_file(yaml_file):
""" load yaml file and check file content format
"""
with io.open(yaml_file, 'r', encoding='utf-8') as stream:
yaml_content = yaml.load(stream)
try:
yaml_content = yaml.load(stream)
except yaml.YAMLError as ex:
logger.log_error(str(ex))
raise exceptions.FileFormatError
check_testcase_format(yaml_file, yaml_content)
return yaml_content