You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to me for class-decorate the task class? Just wondering because when I do, the class decorator gets ignored, but when I do @task @decorator
underneath each method it seems to work, but when I do:
@class_decorator
class CustomTaskSet(TaskSet): @task
def task_1(self):
stuff()
The text was updated successfully, but these errors were encountered:
Hi! From your description, I'm not able to decipher what the issue is. Could you provide a minimal reproducible code example? I've tested with the following code which seems to work fine:
fromlocustimportHttpLocust, TaskSet, taskfromlocust.contrib.fasthttpimportFastHttpLocustdefclass_decorator(original_class):
orig_init=original_class.__init__def__init__(self, *args, **kws):
print("class_decorator")
orig_init(self, *args, **kws)
original_class.__init__=__init__returnoriginal_class@class_decoratorclassUserTasks(TaskSet):
@taskdefindex(self):
self.client.get("/")
@taskdefstats(self):
self.client.get("/stats/requests")
classWebsiteUser(FastHttpLocust):
""" Locust user class that does requests to the locust web server running on localhost """host="http://127.0.0.1:8089"min_wait=2000max_wait=5000task_set=UserTasks
Is there a way to me for class-decorate the task class? Just wondering because when I do, the class decorator gets ignored, but when I do
@task
@decorator
underneath each method it seems to work, but when I do:
@class_decorator
class CustomTaskSet(TaskSet):
@task
def task_1(self):
stuff()
The text was updated successfully, but these errors were encountered: