diff --git a/httprunner/loader.py b/httprunner/loader.py index afaae632..f79c123f 100644 --- a/httprunner/loader.py +++ b/httprunner/loader.py @@ -9,18 +9,12 @@ from typing import Tuple, Dict, Union, Text, List, Callable import yaml from loguru import logger from pydantic import ValidationError +from yaml.loader import FullLoader from httprunner import builtin, utils from httprunner import exceptions from httprunner.models import TestCase, ProjectMeta, TestSuite -try: - # PyYAML version >= 5.1 - # ref: https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation - yaml.warnings({"YAMLLoadWarning": False}) -except AttributeError: - pass - project_meta: Union[ProjectMeta, None] = None @@ -30,7 +24,7 @@ def _load_yaml_file(yaml_file: Text) -> Dict: """ with open(yaml_file, mode="rb") as stream: try: - yaml_content = yaml.load(stream) + yaml_content = yaml.load(stream, loader=FullLoader) except yaml.YAMLError as ex: err_msg = f"YAMLError:\nfile: {yaml_file}\nerror: {ex}" logger.error(err_msg)