mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-07 00:17:37 +08:00
fix: misue of NoReturn
This commit is contained in:
@@ -44,7 +44,7 @@ For compatibility, you can also write upload test script in old way:
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from typing import Text, NoReturn
|
from typing import Text
|
||||||
|
|
||||||
from httprunner.models import TStep, FunctionsMapping
|
from httprunner.models import TStep, FunctionsMapping
|
||||||
from httprunner.parser import parse_variables_mapping
|
from httprunner.parser import parse_variables_mapping
|
||||||
@@ -75,7 +75,7 @@ def ensure_upload_ready():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def prepare_upload_step(step: TStep, functions: FunctionsMapping) -> "NoReturn":
|
def prepare_upload_step(step: TStep, functions: FunctionsMapping):
|
||||||
""" preprocess for upload test
|
""" preprocess for upload test
|
||||||
replace `upload` info with MultipartEncoder
|
replace `upload` info with MultipartEncoder
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -2,7 +2,7 @@ import os
|
|||||||
import string
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from typing import Dict, List, NoReturn, Set, Text, Tuple
|
from typing import Dict, List, Set, Text, Tuple
|
||||||
|
|
||||||
import jinja2
|
import jinja2
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
@@ -133,7 +133,7 @@ def ensure_file_abs_path_valid(file_abs_path: Text) -> Text:
|
|||||||
return new_file_path
|
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
|
""" ensure pytest files are in python module, generate __init__.py on demand
|
||||||
"""
|
"""
|
||||||
init_file = os.path.join(os.path.dirname(path), "__init__.py")
|
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
|
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 ...")
|
logger.info("format pytest cases with black ...")
|
||||||
try:
|
try:
|
||||||
if is_support_multiprocessing() or len(python_paths) <= 1:
|
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
|
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"""
|
"""convert valid testsuite dict to pytest folder with testcases"""
|
||||||
# validate testsuite format
|
# validate testsuite format
|
||||||
load_testsuite(testsuite)
|
load_testsuite(testsuite)
|
||||||
@@ -493,7 +493,7 @@ def make_testsuite(testsuite: Dict) -> NoReturn:
|
|||||||
pytest_files_run_set.add(testcase_pytest_path)
|
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
|
""" make testcase(s) with testcase/testsuite/folder absolute path
|
||||||
generated pytest file path will be cached in pytest_files_made_cache_mapping
|
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 jmespath
|
||||||
import requests
|
import requests
|
||||||
@@ -193,7 +193,7 @@ class ResponseObject(object):
|
|||||||
validators: Validators,
|
validators: Validators,
|
||||||
variables_mapping: VariablesMapping = None,
|
variables_mapping: VariablesMapping = None,
|
||||||
functions_mapping: FunctionsMapping = None,
|
functions_mapping: FunctionsMapping = None,
|
||||||
) -> NoReturn:
|
):
|
||||||
|
|
||||||
variables_mapping = variables_mapping or {}
|
variables_mapping = variables_mapping or {}
|
||||||
functions_mapping = functions_mapping or {}
|
functions_mapping = functions_mapping or {}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import os
|
|||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List, Dict, Text, NoReturn
|
from typing import List, Dict, Text
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import allure
|
import allure
|
||||||
@@ -55,7 +55,7 @@ class HttpRunner(object):
|
|||||||
# log
|
# log
|
||||||
__log_path: Text = ""
|
__log_path: Text = ""
|
||||||
|
|
||||||
def __init_tests__(self) -> NoReturn:
|
def __init_tests__(self):
|
||||||
self.__config = self.config.perform()
|
self.__config = self.config.perform()
|
||||||
self.__teststeps = []
|
self.__teststeps = []
|
||||||
for step in self.teststeps:
|
for step in self.teststeps:
|
||||||
@@ -90,7 +90,7 @@ class HttpRunner(object):
|
|||||||
|
|
||||||
def __call_hooks(
|
def __call_hooks(
|
||||||
self, hooks: Hooks, step_variables: VariablesMapping, hook_msg: Text,
|
self, hooks: Hooks, step_variables: VariablesMapping, hook_msg: Text,
|
||||||
) -> NoReturn:
|
):
|
||||||
""" call hook actions.
|
""" call hook actions.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -304,7 +304,7 @@ class HttpRunner(object):
|
|||||||
logger.info(f"run step end: {step.name} <<<<<<\n")
|
logger.info(f"run step end: {step.name} <<<<<<\n")
|
||||||
return step_data.export_vars
|
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.update(self.__session_variables)
|
||||||
config.variables = parse_variables_mapping(
|
config.variables = parse_variables_mapping(
|
||||||
config.variables, self.__project_meta.functions
|
config.variables, self.__project_meta.functions
|
||||||
|
|||||||
Reference in New Issue
Block a user