mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-13 19:59:37 +08:00
fix: remove misuse of NoReturn in Python typing
This commit is contained in:
@@ -3,9 +3,16 @@
|
||||
## 4.0.0
|
||||
|
||||
- refactor: merge [hrp] into httprunner repo
|
||||
- fix: call referenced api/testcase with relative path
|
||||
- fix: ignore exceptions when reporting GA events
|
||||
|
||||
**go version**
|
||||
|
||||
- change: integrate [sentry sdk][sentry sdk] for panic reporting and analysis
|
||||
- fix: call referenced api/testcase with relative path
|
||||
|
||||
**python version**
|
||||
|
||||
- fix: ignore exceptions when reporting GA events
|
||||
- fix: remove misuse of NoReturn in Python typing
|
||||
|
||||
## hrp-v0.8.0 (2022-03-22)
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ For compatibility, you can also write upload test script in old way:
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Text, NoReturn
|
||||
from typing import Text
|
||||
|
||||
from httprunner.models import TStep, FunctionsMapping
|
||||
from httprunner.parser import parse_variables_mapping
|
||||
@@ -75,7 +75,7 @@ def ensure_upload_ready():
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def prepare_upload_step(step: TStep, functions: FunctionsMapping) -> "NoReturn":
|
||||
def prepare_upload_step(step: TStep, functions: FunctionsMapping):
|
||||
""" preprocess for upload test
|
||||
replace `upload` info with MultipartEncoder
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
from typing import Dict, List, NoReturn, Set, Text, Tuple
|
||||
from typing import Dict, List, Set, Text, Tuple
|
||||
|
||||
import jinja2
|
||||
from loguru import logger
|
||||
@@ -133,7 +133,7 @@ def ensure_file_abs_path_valid(file_abs_path: Text) -> Text:
|
||||
return new_file_path
|
||||
|
||||
|
||||
def __ensure_testcase_module(path: Text) -> NoReturn:
|
||||
def __ensure_testcase_module(path: Text):
|
||||
""" ensure pytest files are in python module, generate __init__.py on demand
|
||||
"""
|
||||
init_file = os.path.join(os.path.dirname(path), "__init__.py")
|
||||
@@ -158,7 +158,7 @@ def convert_testcase_path(testcase_abs_path: Text) -> Tuple[Text, Text]:
|
||||
return testcase_python_abs_path, name_in_title_case
|
||||
|
||||
|
||||
def format_pytest_with_black(*python_paths: Text) -> NoReturn:
|
||||
def format_pytest_with_black(*python_paths: Text):
|
||||
logger.info("format pytest cases with black ...")
|
||||
try:
|
||||
if is_support_multiprocessing() or len(python_paths) <= 1:
|
||||
@@ -436,7 +436,7 @@ def make_testcase(testcase: Dict, dir_path: Text = None) -> Text:
|
||||
return testcase_python_abs_path
|
||||
|
||||
|
||||
def make_testsuite(testsuite: Dict) -> NoReturn:
|
||||
def make_testsuite(testsuite: Dict):
|
||||
"""convert valid testsuite dict to pytest folder with testcases"""
|
||||
# validate testsuite format
|
||||
load_testsuite(testsuite)
|
||||
@@ -493,7 +493,7 @@ def make_testsuite(testsuite: Dict) -> NoReturn:
|
||||
pytest_files_run_set.add(testcase_pytest_path)
|
||||
|
||||
|
||||
def __make(tests_path: Text) -> NoReturn:
|
||||
def __make(tests_path: Text):
|
||||
""" make testcase(s) with testcase/testsuite/folder absolute path
|
||||
generated pytest file path will be cached in pytest_files_made_cache_mapping
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Dict, Text, Any, NoReturn
|
||||
from typing import Dict, Text, Any
|
||||
|
||||
import jmespath
|
||||
import requests
|
||||
@@ -153,7 +153,7 @@ class ResponseObject(object):
|
||||
}
|
||||
if not expr.startswith(tuple(resp_obj_meta.keys())):
|
||||
return expr
|
||||
|
||||
|
||||
try:
|
||||
check_value = jmespath.search(expr, resp_obj_meta)
|
||||
except JMESPathError as ex:
|
||||
@@ -193,7 +193,7 @@ class ResponseObject(object):
|
||||
validators: Validators,
|
||||
variables_mapping: VariablesMapping = None,
|
||||
functions_mapping: FunctionsMapping = None,
|
||||
) -> NoReturn:
|
||||
):
|
||||
|
||||
variables_mapping = variables_mapping or {}
|
||||
functions_mapping = functions_mapping or {}
|
||||
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
import time
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import List, Dict, Text, NoReturn
|
||||
from typing import List, Dict, Text
|
||||
|
||||
try:
|
||||
import allure
|
||||
@@ -55,7 +55,7 @@ class HttpRunner(object):
|
||||
# log
|
||||
__log_path: Text = ""
|
||||
|
||||
def __init_tests__(self) -> NoReturn:
|
||||
def __init_tests__(self):
|
||||
self.__config = self.config.perform()
|
||||
self.__teststeps = []
|
||||
for step in self.teststeps:
|
||||
@@ -88,9 +88,7 @@ class HttpRunner(object):
|
||||
self.__export = export
|
||||
return self
|
||||
|
||||
def __call_hooks(
|
||||
self, hooks: Hooks, step_variables: VariablesMapping, hook_msg: Text,
|
||||
) -> NoReturn:
|
||||
def __call_hooks(self, hooks: Hooks, step_variables: VariablesMapping, hook_msg: Text):
|
||||
""" call hook actions.
|
||||
|
||||
Args:
|
||||
@@ -139,11 +137,12 @@ class HttpRunner(object):
|
||||
step_data = StepData(name=step.name)
|
||||
|
||||
# parse
|
||||
prepare_upload_step(step, self.__project_meta.functions)
|
||||
functions = self.__project_meta.functions
|
||||
# prepare_upload_step(step, functions)
|
||||
request_dict = step.request.dict()
|
||||
request_dict.pop("upload", None)
|
||||
parsed_request_dict = parse_data(
|
||||
request_dict, step.variables, self.__project_meta.functions
|
||||
request_dict, step.variables, functions
|
||||
)
|
||||
parsed_request_dict["headers"].setdefault(
|
||||
"HRUN-Request-ID",
|
||||
@@ -195,7 +194,7 @@ class HttpRunner(object):
|
||||
|
||||
# extract
|
||||
extractors = step.extract
|
||||
extract_mapping = resp_obj.extract(extractors, step.variables, self.__project_meta.functions)
|
||||
extract_mapping = resp_obj.extract(extractors, step.variables, functions)
|
||||
step_data.export_vars = extract_mapping
|
||||
|
||||
variables_mapping = step.variables
|
||||
@@ -206,7 +205,7 @@ class HttpRunner(object):
|
||||
session_success = False
|
||||
try:
|
||||
resp_obj.validate(
|
||||
validators, variables_mapping, self.__project_meta.functions
|
||||
validators, variables_mapping, functions
|
||||
)
|
||||
session_success = True
|
||||
except ValidationFailure:
|
||||
@@ -304,7 +303,7 @@ class HttpRunner(object):
|
||||
logger.info(f"run step end: {step.name} <<<<<<\n")
|
||||
return step_data.export_vars
|
||||
|
||||
def __parse_config(self, config: TConfig) -> NoReturn:
|
||||
def __parse_config(self, config: TConfig):
|
||||
config.variables.update(self.__session_variables)
|
||||
config.variables = parse_variables_mapping(
|
||||
config.variables, self.__project_meta.functions
|
||||
|
||||
Reference in New Issue
Block a user