change: add weight attribute in config
This commit is contained in:
parent
2dcbee79e0
commit
fed8d5adaf
|
@ -41,6 +41,7 @@ class TConfig(BaseModel):
|
|||
# teardown_hooks: Hooks = []
|
||||
export: Export = []
|
||||
path: Text = None
|
||||
weight: int = 1
|
||||
|
||||
|
||||
class TRequest(BaseModel):
|
||||
|
|
|
@ -17,18 +17,23 @@ class Config(object):
|
|||
self.__base_url = ""
|
||||
self.__verify = False
|
||||
self.__export = []
|
||||
self.__weight = 1
|
||||
|
||||
caller_frame = inspect.stack()[1]
|
||||
self.__path = caller_frame.filename
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
def name(self) -> Text:
|
||||
return self.__name
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
def path(self) -> Text:
|
||||
return self.__path
|
||||
|
||||
@property
|
||||
def weight(self) -> int:
|
||||
return self.__weight
|
||||
|
||||
def variables(self, **variables) -> "Config":
|
||||
self.__variables.update(variables)
|
||||
return self
|
||||
|
@ -45,6 +50,10 @@ class Config(object):
|
|||
self.__export.extend(export_var_name)
|
||||
return self
|
||||
|
||||
def locust_weight(self, weight: int) -> "Config":
|
||||
self.__weight = weight
|
||||
return self
|
||||
|
||||
def perform(self) -> TConfig:
|
||||
return TConfig(
|
||||
name=self.__name,
|
||||
|
@ -53,6 +62,7 @@ class Config(object):
|
|||
variables=self.__variables,
|
||||
export=list(set(self.__export)),
|
||||
path=self.__path,
|
||||
weight=self.__weight,
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue