mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-25 01:59:52 +08:00
Merge pull request #1384 from xucong053/bugfix
fix: only get the first parameter in referenced testcase
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
|
import copy
|
||||||
import inspect
|
import inspect
|
||||||
from typing import Text
|
from typing import Text
|
||||||
|
|
||||||
from httprunner.models import TConfig, TConfigThrift, TConfigDB, ProtoType
|
from httprunner.models import TConfig, TConfigThrift, TConfigDB, ProtoType, VariablesMapping
|
||||||
|
|
||||||
|
|
||||||
class ConfigThrift(object):
|
class ConfigThrift(object):
|
||||||
@@ -89,6 +90,9 @@ class ConfigDB(object):
|
|||||||
class Config(object):
|
class Config(object):
|
||||||
def __init__(self, name: Text) -> None:
|
def __init__(self, name: Text) -> None:
|
||||||
caller_frame = inspect.stack()[1]
|
caller_frame = inspect.stack()[1]
|
||||||
|
self.__name: Text = name
|
||||||
|
self.__base_url: Text = ""
|
||||||
|
self.__variables: VariablesMapping = {}
|
||||||
self.__config = TConfig(name=name, path=caller_frame.filename)
|
self.__config = TConfig(name=name, path=caller_frame.filename)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -100,11 +104,11 @@ class Config(object):
|
|||||||
return self.__config.path
|
return self.__config.path
|
||||||
|
|
||||||
def variables(self, **variables) -> "Config":
|
def variables(self, **variables) -> "Config":
|
||||||
self.__config.variables.update(variables)
|
self.__variables.update(variables)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def base_url(self, base_url: Text) -> "Config":
|
def base_url(self, base_url: Text) -> "Config":
|
||||||
self.__config.base_url = base_url
|
self.__base_url = base_url
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def verify(self, verify: bool) -> "Config":
|
def verify(self, verify: bool) -> "Config":
|
||||||
@@ -117,10 +121,18 @@ class Config(object):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
def struct(self) -> TConfig:
|
def struct(self) -> TConfig:
|
||||||
|
self.__init()
|
||||||
return self.__config
|
return self.__config
|
||||||
|
|
||||||
def thrift(self) -> ConfigThrift:
|
def thrift(self) -> ConfigThrift:
|
||||||
|
self.__init()
|
||||||
return ConfigThrift(self.__config)
|
return ConfigThrift(self.__config)
|
||||||
|
|
||||||
def db(self) -> ConfigDB:
|
def db(self) -> ConfigDB:
|
||||||
|
self.__init()
|
||||||
return ConfigDB(self.__config)
|
return ConfigDB(self.__config)
|
||||||
|
|
||||||
|
def __init(self) -> None:
|
||||||
|
self.__config.name = self.__name
|
||||||
|
self.__config.base_url = self.__base_url
|
||||||
|
self.__config.variables = copy.copy(self.__variables)
|
||||||
|
|||||||
Reference in New Issue
Block a user