From c57714bbfef23f0adeb049ccf9323b6894391410 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Tue, 22 Mar 2022 16:34:07 +0800 Subject: [PATCH] change: load yaml file with FullLoader --- docs/CHANGELOG.md | 4 ++++ httprunner/__init__.py | 2 +- httprunner/loader.py | 11 ++++------- pyproject.toml | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index fbf2320a..ebffeb3f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 3.1.8 (2022-03-22) + +- change: load yaml file with FullLoader + ## 3.1.7 (2022-03-22) - fix #1117: ignore comments and blank lines when parsing .env file diff --git a/httprunner/__init__.py b/httprunner/__init__.py index d57ef6ff..74e8cf1d 100644 --- a/httprunner/__init__.py +++ b/httprunner/__init__.py @@ -1,4 +1,4 @@ -__version__ = "3.1.7" +__version__ = "3.1.8-beta" __description__ = "One-stop solution for HTTP(S) testing." # import firstly for monkey patch if needed diff --git a/httprunner/loader.py b/httprunner/loader.py index fdb7edc4..6c81fd82 100644 --- a/httprunner/loader.py +++ b/httprunner/loader.py @@ -4,17 +4,14 @@ import json import os import sys import types -from typing import Tuple, Dict, Union, Text, List, Callable +from typing import Callable, Dict, List, Text, Tuple, Union 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 +from httprunner import builtin, exceptions, utils +from httprunner.models import ProjectMeta, TestCase, TestSuite project_meta: Union[ProjectMeta, None] = None @@ -24,7 +21,7 @@ def _load_yaml_file(yaml_file: Text) -> Dict: """ with open(yaml_file, mode="rb") as stream: try: - yaml_content = yaml.load(stream, loader=FullLoader) + yaml_content = yaml.load(stream, Loader=yaml.FullLoader) except yaml.YAMLError as ex: err_msg = f"YAMLError:\nfile: {yaml_file}\nerror: {ex}" logger.error(err_msg) diff --git a/pyproject.toml b/pyproject.toml index 627acd15..a17c0b43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "httprunner" -version = "3.1.7" +version = "3.1.8-beta" description = "One-stop solution for HTTP(S) testing." license = "Apache-2.0" readme = "docs/README.md"