mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 08:59:44 +08:00
Merge pull request #2 from billduan/feat_decoupling
fix: RunThriftRequest
This commit is contained in:
@@ -2,6 +2,7 @@ __version__ = "v4.0.0"
|
||||
__description__ = "One-stop solution for HTTP(S) testing."
|
||||
|
||||
from httprunner.config import Config
|
||||
import platform
|
||||
from httprunner.parser import parse_parameters as Parameters
|
||||
from httprunner.runner import HttpRunner
|
||||
from httprunner.step import Step
|
||||
@@ -12,11 +13,6 @@ from httprunner.step_sql_request import (
|
||||
StepSqlRequestValidation,
|
||||
StepSqlRequestExtraction,
|
||||
)
|
||||
from httprunner.step_thrift_request import (
|
||||
RunThriftRequest,
|
||||
StepThriftRequestValidation,
|
||||
StepThriftRequestExtraction,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"__version__",
|
||||
@@ -28,9 +24,20 @@ __all__ = [
|
||||
"RunSqlRequest",
|
||||
"StepSqlRequestValidation",
|
||||
"StepSqlRequestExtraction",
|
||||
"RunThriftRequest",
|
||||
"StepThriftRequestValidation",
|
||||
"StepThriftRequestExtraction",
|
||||
"RunTestCase",
|
||||
"Parameters",
|
||||
]
|
||||
if platform.system() != "Windows":
|
||||
from httprunner.step_thrift_request import (
|
||||
RunThriftRequest,
|
||||
StepThriftRequestValidation,
|
||||
StepThriftRequestExtraction,
|
||||
)
|
||||
|
||||
__all__.extend(
|
||||
[
|
||||
"RunThriftRequest",
|
||||
"StepThriftRequestValidation",
|
||||
"StepThriftRequestExtraction",
|
||||
]
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import platform
|
||||
from typing import Union
|
||||
|
||||
from httprunner.models import StepResult, TRequest, TStep, TestCase
|
||||
@@ -14,8 +15,6 @@ from httprunner.step_sql_request import (
|
||||
StepSqlRequestExtraction,
|
||||
)
|
||||
|
||||
from httprunner.step_thrift_request import RunThriftRequest,StepThriftRequestValidation,StepThriftRequestExtraction
|
||||
|
||||
|
||||
class Step(object):
|
||||
def __init__(
|
||||
@@ -28,9 +27,6 @@ class Step(object):
|
||||
RunSqlRequest,
|
||||
StepSqlRequestValidation,
|
||||
StepSqlRequestExtraction,
|
||||
RunThriftRequest,
|
||||
StepThriftRequestValidation,
|
||||
StepThriftRequestExtraction
|
||||
],
|
||||
):
|
||||
self.__step = step
|
||||
@@ -62,3 +58,29 @@ class Step(object):
|
||||
|
||||
def run(self, runner: HttpRunner) -> StepResult:
|
||||
return self.__step.run(runner)
|
||||
|
||||
|
||||
if platform.system() != "Windows":
|
||||
from httprunner.step_thrift_request import (
|
||||
RunThriftRequest,
|
||||
StepThriftRequestValidation,
|
||||
StepThriftRequestExtraction,
|
||||
)
|
||||
|
||||
class Step(Step):
|
||||
def __init__(
|
||||
self,
|
||||
step: Union[
|
||||
StepRequestValidation,
|
||||
StepRequestExtraction,
|
||||
RequestWithOptionalArgs,
|
||||
StepRefCase,
|
||||
RunSqlRequest,
|
||||
StepSqlRequestValidation,
|
||||
StepSqlRequestExtraction,
|
||||
RunThriftRequest,
|
||||
StepThriftRequestValidation,
|
||||
StepThriftRequestExtraction,
|
||||
],
|
||||
):
|
||||
super().__init__(step)
|
||||
|
||||
@@ -189,7 +189,9 @@ class RunThriftRequest(IStep):
|
||||
|
||||
return self
|
||||
|
||||
def setup_hook(self, hook: Text, assign_var_name: Text = None) -> "RunTestCase":
|
||||
def setup_hook(
|
||||
self, hook: Text, assign_var_name: Text = None
|
||||
) -> "RunThriftRequest":
|
||||
if assign_var_name:
|
||||
self.__step.setup_hooks.append({assign_var_name: hook})
|
||||
else:
|
||||
|
||||
28
poetry.lock
generated
28
poetry.lock
generated
@@ -623,7 +623,7 @@ name = "six"
|
||||
version = "1.16.0"
|
||||
description = "Python 2 and 3 compatibility utilities"
|
||||
category = "main"
|
||||
optional = true
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
|
||||
[package.source]
|
||||
@@ -669,6 +669,27 @@ type = "legacy"
|
||||
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
|
||||
reference = "tsinghua"
|
||||
|
||||
[[package]]
|
||||
name = "thrift"
|
||||
version = "0.16.0"
|
||||
description = "Python bindings for the Apache Thrift RPC system"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[package.dependencies]
|
||||
six = ">=1.7.2"
|
||||
|
||||
[package.extras]
|
||||
all = ["tornado (>=4.0)", "twisted"]
|
||||
tornado = ["tornado (>=4.0)"]
|
||||
twisted = ["twisted"]
|
||||
|
||||
[package.source]
|
||||
type = "legacy"
|
||||
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
|
||||
reference = "tsinghua"
|
||||
|
||||
[[package]]
|
||||
name = "thriftpy2"
|
||||
version = "0.4.14"
|
||||
@@ -799,7 +820,7 @@ upload = ["requests-toolbelt", "filetype"]
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.7"
|
||||
content-hash = "73bf6bfc1612775dd37dd94bb73b73d6de7a38bb3dad7c027c24f7d3d0209e62"
|
||||
content-hash = "15f15916b41e180ee7567716713607183f5d8c8d30300c24dada98be454bc675"
|
||||
|
||||
[metadata.files]
|
||||
allure-pytest = [
|
||||
@@ -1275,6 +1296,9 @@ sqlalchemy = [
|
||||
{file = "SQLAlchemy-1.4.36-cp39-cp39-win_amd64.whl", hash = "sha256:cb441ca461bf97d00877b607f132772644b623518b39ced54da433215adce691"},
|
||||
{file = "SQLAlchemy-1.4.36.tar.gz", hash = "sha256:64678ac321d64a45901ef2e24725ec5e783f1f4a588305e196431447e7ace243"},
|
||||
]
|
||||
thrift = [
|
||||
{file = "thrift-0.16.0.tar.gz", hash = "sha256:2b5b6488fcded21f9d312aa23c9ff6a0195d0f6ae26ddbd5ad9e3e25dfc14408"},
|
||||
]
|
||||
thriftpy2 = [
|
||||
{file = "thriftpy2-0.4.14-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:b4aae6f6c1d8d12e63c45f68ec1a25267e7d3af1ced1e5a82cbabaaed4bcebc9"},
|
||||
{file = "thriftpy2-0.4.14.tar.gz", hash = "sha256:1758ccaeb2a40d8779b50cdd3d7a3b43e8c5752f21ad0a54ded7c251d05219e8"},
|
||||
|
||||
@@ -48,6 +48,7 @@ toml = "^0.10.2"
|
||||
sqlalchemy = "^1.4.36"
|
||||
cython = "^0.29.28"
|
||||
thriftpy2 = "^0.4.14"
|
||||
thrift = "^0.16.0"
|
||||
|
||||
[tool.poetry.extras]
|
||||
allure = ["allure-pytest"] # pip install "httprunner[allure]", poetry install -E allure
|
||||
|
||||
Reference in New Issue
Block a user