Я совсем новичок в Locust
, только начал возиться с ним пару дней go. Чтобы быстро начать, я следовал другому примеру, как показано ниже, файл: locustfile.py
import random
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
def on_start(self):
""" on_start is called when a Locust start before
any task is scheduled
"""
self.login()
def login(self):
self.client.post("/login",
{"username":"ellen_key",
"password":"education"})
@task(2)
def index(self):
self.client.get("/")
@task(1)
def profile(self):
self.client.get("/profile")
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait = 5000
max_wait = 9000
Когда я запускаю locust из текущего каталога, я получаю следующее исключение:
Traceback (most recent call last):
File "/usr/local/bin/locust", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/locust/main.py", line 113, in main
docstring, user_classes = load_locustfile(locustfile)
File "/usr/local/lib/python3.6/dist-packages/locust/main.py", line 77, in load_locustfile
imported = __import_locustfile__(locustfile, path)
File "/usr/local/lib/python3.6/dist-packages/locust/main.py", line 53, in __import_locustfile__
return source.load_module()
File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 823, in load_module
File "<frozen importlib._bootstrap_external>", line 682, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/koushic/kk-ldl/locust/locustfile.py", line 19, in <module>
class WebsiteUser(HttpLocust):
File "/usr/local/lib/python3.6/dist-packages/locust/util/deprecation.py", line 23, in __new__
raise ImportError(deprecation_message)
ImportError: The HttpLocust class has been renamed to HttpUser in version 1.0. For more info see: https://docs.locust.io/en/latest/changelog.html#changelog-1-0
Может ли кто-нибудь помочь мне разобраться в проблеме здесь.
Python 3.6.9
pip 20.1.1